This repository is an add-on that provides Mongo and Mongo Express for [DDEV](https://ddev.readthedocs. io/en/stable/).
It's based on MongoDb from Docker Hub, DDEV custom compose files and API Platform tutorial.
For DDEV v1.23.5 or above run
ddev add-on get ddev/ddev-mongo
For earlier versions of DDEV run
ddev get ddev/ddev-mongo
Then restart your project
ddev restart
-
Your project will likely require the Doctrine MongoDB ODM bundle
ddev composer require doctrine/mongodb-odm-bundle:^4.0.0@beta doctrine/mongodb-odm:^2.0.0@beta
-
In your application
.env
or other client, set the connection string:MONGODB_URL=mongodb://db:db@mongo:27017
Mongo Express will now be accessible by running ddev mongo-express
command.
This command will run the mongosh
(mongoDB Shell) command in the mongo
container. Please read the documentation for more information.
This command opens your browser to the Mongo Express page.
- The php extension (phpX.X-mongodb) is set up in
.ddev/config.mongo.yaml
usingwebimage_extra_packages
. You may want to edit your config.yaml to do what you want and remove the config.mongo.yaml. - You can't define custom MongoDB configuration with this current setup.
- You can't use
ddev import-db
to import to mongo.
Based on the original ddev-contrib recipe
Originally contributed by @wtfred
Maintained by @julienloizelet