Laravel-mongodb: why it's not working in laravel 7.0 version

Created on 1 Apr 2020  路  15Comments  路  Source: jenssegers/laravel-mongodb

It gives a lots of issues

Problem 1
- mongodb/mongodb 1.6.0 requires ext-mongodb ^1.7 -> the requested PHP extension mongodb is missing from your system.
- mongodb/mongodb 1.6.0 requires ext-mongodb ^1.7 -> the requested PHP extension mongodb is missing from your system.
- mongodb/mongodb 1.6.0 requires ext-mongodb ^1.7 -> the requested PHP extension mongodb is missing from your system.
- Installation request for mongodb/mongodb (locked at 1.6.0, required as ^1.6) -> satisfiable by mongodb/mongodb[1.6.0].

To enable extensions, verify that they are enabled in your .ini files:
- C:\xampp\php\php.ini
You can also run php --ini inside terminal to see which files are used by PHP in CLI mode.

Installation failed, reverting ./composer.json to its original content.
PS C:\xampp\htdocs\example> pecl install mongodb
^CTerminate batch job (Y/N)? y
PS C:\xampp\htdocs\example> composer require jenssegers/mongodb:dev-develop
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.

Problem 1
- mongodb/mongodb 1.6.0 requires ext-mongodb ^1.7 -> the requested PHP extension mongodb is missing from your system.
- mongodb/mongodb 1.6.0 requires ext-mongodb ^1.7 -> the requested PHP extension mongodb is missing from your system.
- mongodb/mongodb 1.6.0 requires ext-mongodb ^1.7 -> the requested PHP extension mongodb is missing from your system.
- Installation request for mongodb/mongodb (locked at 1.6.0, required as ^1.6) -> satisfiable by mongodb/mongodb[1.6.0].

To enable extensions, verify that they are enabled in your .ini files:
- C:\xampp\php\php.ini
You can also run php --ini inside terminal to see which files are used by PHP in CLI mode.

Installation failed, reverting ./composer.json to its original content.

question

Most helpful comment

@Prince-254 you can use it with Laravel 7 if you change it to "jenssegers/mongodb": "dev-develop", in your composer.json

I've done this and haven't run into any issues yet.

On a side note, I've decided to abandon using MongoDB in my project alongside MySQL. It seemed like a good idea at the time but now that Mysql 5.7 / 8 has excellent support and performance dealing with and querying JSON fields, Laravel has built-in JSON field support inside Eloquent.. and Mysql now supports GeoSpatial queries.. it's no longer worth the extra overhead and complexity of supporting MongoDB both from a Laravel point of view and from a server deployment point of view. I ported my code to a pure MySQL solution in the last two days and it was surprisingly painless and simple. I thank the developers of this excellent package over the years, it's just no longer for me going forward.

All 15 comments

Check extension php -m

Check extension php -m
It's showing this

PS C:\xampp\htdocs\example> php -m
[PHP Modules]
bcmath
bz2
calendar
Core
ctype
curl
date
dom
exif
fileinfo
filter
ftp
gd
gettext
hash
iconv
json
libxml
mbstring
mysqli
mysqlnd
openssl
pcre
PDO
pdo_mysql
pdo_sqlite
Phar
readline
Reflection
session
SimpleXML
SPL
standard
tokenizer
wddx
xml
xmlreader
xmlwriter
zip
zlib

[Zend Modules]

@shailesh5152 install mongodb extension

@shailesh5152 install mongodb extension

I installed it

C:\Users\hp>php -m
[PHP Modules]
bcmath
bz2
calendar
Core
ctype
curl
date
dom
exif
fileinfo
filter
ftp
gd
gettext
hash
iconv
json
libxml
mbstring
mongodb
mysqli

but I am also facing same problem after entering this below command

composer require jenssegers/mongodb

Your requirements could not be resolved to an installable set of packages.

Problem 1
- Conclusion: don't install jenssegers/mongodb v3.6.3
- Conclusion: don't install jenssegers/mongodb v3.6.2
- Conclusion: don't install jenssegers/mongodb v3.6.1
- Conclusion: remove laravel/framework v7.4.0
- Installation request for jenssegers/mongodb ^3.6 -> satisfiable by jenssegers/mongodb[v3.6.0, v3.6.1, v3.6.2, v3.6.3].
- Conclusion: don't install laravel/framework v7.4.0

Show your composer.json, please

Show your composer.json, please

{
"name": "laravel/laravel",
"type": "project",
"description": "The Laravel Framework.",
"keywords": [
"framework",
"laravel"
],
"license": "MIT",
"require": {
"php": "^7.2.5",
"fideloper/proxy": "^4.2",
"fruitcake/laravel-cors": "^1.0",
"guzzlehttp/guzzle": "^6.3",
"laravel/framework": "^7.0",
"laravel/tinker": "^2.0",
"mongodb/mongodb": "^1.6"
},
"require-dev": {
"facade/ignition": "^2.0",
"fzaninotto/faker": "^1.9.1",
"laravel/ui": "^2.0",
"mockery/mockery": "^1.3.1",
"nunomaduro/collision": "^4.1",
"phpunit/phpunit": "^8.5"
},
"config": {
"optimize-autoloader": true,
"preferred-install": "dist",
"sort-packages": true
},
"extra": {
"laravel": {
"dont-discover": []
}
},
"autoload": {
"psr-4": {
"App\": "app/"
},
"classmap": [
"database/seeds",
"database/factories"
]
},
"autoload-dev": {
"psr-4": {
"Tests\": "tests/"
}
},
"minimum-stability": "dev",
"prefer-stable": true,
"scripts": {
"post-autoload-dump": [
"Illuminate\Foundation\ComposerScripts::postAutoloadDump",
"@php artisan package:discover --ansi"
],
"post-root-package-install": [
"@php -r \"file_exists('.env') || copy('.env.example', '.env');\""
],
"post-create-project-cmd": [
"@php artisan key:generate --ansi"
]
}
}

I'm getting the same issue although it looks like the package needs Laravel 5.8 to 6.8:

  • jenssegers/mongodb v3.6.0 requires illuminate/events ^5.8|^6.0 -> satisfiable by illuminate/events[5.8.x-dev, 6.x-dev, v5.8.0, v5.8.11, v5.8.12, v5.8.14, v5.8.15, v5.8.17, v5.8.18, v5.8.19, v5.8.2, v5.8.20, v5.8.22, v5.8.24, v5.8.27, v5.8.28, v5.8.29, v5.8.3, v5.8.30, v5.8.31, v5.8.32, v5.8.33, v5.8.34, v5.8.35, v5.8.36, v5.8.4, v5.8.8, v5.8.9, v6.0.0, v6.0.1, v6.0.2, v6.0.3, v6.0.4, v6.1.0, v6.10.0, v6.11.0, v6.12.0, v6.13.0, v6.13.1, v6.14.0, v6.15.0, v6.15.1, v6.16.0, v6.17.0, v6.17.1, v6.18.0, v6.18.1, v6.18.2, v6.18.3, v6.2.0, v6.3.0, v6.4.1, v6.5.0, v6.5.1, v6.5.2, v6.6.0, v6.6.1, v6.6.2, v6.7.0, v6.8.0].

Edit: I read through #1974 and see it won't be available to Laravel 7.x till version 4. No problem, I'll stick with MySQL for now. :)

Does anyone have a fork with Laravel 7 compatibility added that's ready to use right now and works with the 3.6 branch?

@vesper8 , we have using of 7 laravel in development branch, but we don't test on bugs and not implement new features

@Smolevich Any estimation when 4.0 will be released? Is it a week away? a month? more? Thanks

I'm having the same issue and this is as fur as I can get at the moment. There's no support for Laravel 7 apparently at the moment

@Smolevich Any estimation when 4.0 will be released? Is it a week away? a month? more? Thanks

We don't discuss about time new release

@Prince-254 you can use it with Laravel 7 if you change it to "jenssegers/mongodb": "dev-develop", in your composer.json

I've done this and haven't run into any issues yet.

On a side note, I've decided to abandon using MongoDB in my project alongside MySQL. It seemed like a good idea at the time but now that Mysql 5.7 / 8 has excellent support and performance dealing with and querying JSON fields, Laravel has built-in JSON field support inside Eloquent.. and Mysql now supports GeoSpatial queries.. it's no longer worth the extra overhead and complexity of supporting MongoDB both from a Laravel point of view and from a server deployment point of view. I ported my code to a pure MySQL solution in the last two days and it was surprisingly painless and simple. I thank the developers of this excellent package over the years, it's just no longer for me going forward.

you can use "jenssegers/mongodb": "^4" in Laravel 7

Was this page helpful?
0 / 5 - 0 ratings