laravel-mongodb
laravel-mongodb copied to clipboard
Jobs, commands, and seeders cannot run due to error when interacting with mongodb database
- Laravel-mongodb Version: 3.8.0
- PHP Version: 7.3.8
- Database Driver & Version: mongodb php extension, version 1.11.0alpha1
Description:
My app uses two databases, one mysql one mongodb. When attempting to run any job or command that interacts with the mongodb database, the following error occurs -> "Argument 1 passed to MongoDB\server_supports_feature() must be an instance of MongoDB\Driver\Server, null given, called in /vendor/mongodb/mongodb/src/Collection.php on line 653"
Steps to reproduce
- Create a command or a job that runs some operation on the mongodb database. Any operation should do (read, update, etc)
- Run the command on the command line or through a schedule. Or run the job through the queue worker. The output of the command or job should be an error
Expected behaviour
The command or job should run and update the corresponding data normally, since the same code works fine when its not executed from within a job or command
Actual behaviour
The command or job fail and the error message is displayed -> "Argument 1 passed to MongoDB\server_supports_feature() must be an instance of MongoDB\Driver\Server, null given, called in /vendor/mongodb/mongodb/src/Collection.php on line 653"