Skip to content

ddev/ddev-mongo

Repository files navigation

tests project is maintained

What is ddev-mongo?

This repository provides Mongo and Mongo Express add-on to DDEV.

It's based on MongoDb from Docker Hub, DDEV custom compose files and API Platform tutorial.

Configuration

  1. 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

  2. In your application .env or other client, set the connection string:

    MONGODB_URL=mongodb://db:db@mongo:27017
    MONGODB_DB=api
    

Mongo Express will now be accessible from http://<project>.ddev.site:9091

Features

ddev mongosh command

This command will run the mongosh (mongoDB Shell) command in the mongo container. Please read the documentation for more information.

Caveats:

  • The php extension (phpX.X-mongodb) is set up in .ddev/config.mongo.yaml using webimage_extra_packages. If you have an earlier webimage_extra_packages in your config.yaml, this will override it. 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