I'm using Symfony 5
I'm able to connect to mongo db using MongoDB Compass and in terminal using mongo command
What packages I have installed are the following:
My configuration file monolog.yaml (config/packages/dev/monolog.yaml) is like the following:
monolog:
handlers:
mongo:
type: mongo
mongo:
host: localhost
Thank you.
I had installed mongodb with brew. And I figured out MongoDB\Client class was not recognized. Then I found that we can install mongo driver manually.
I followed the steps here : https://www.php.net/manual/en/mongodb.installation.manual.php
I've changed my monolog configuration file monolog.yaml as
monolog:
handlers:
mongodb:
type: mongo
mongo:
id: mongolog
services:
...
mongolog:
class: MongoDB\Client
And after doing things above, it's worked.