MongoDB is a NoSQL document database that can be enabled in your development environment. It comes with mongo-express, a web-based MongoDB admin interface.
Enable MongoDB during the initial setup by running:
dev setupIf you've already set up your environment, you can enable MongoDB by creating a configuration marker:
mkdir -p conf/mongo
dev rebuildMongoDB runs with default credentials:
- Username:
root - Password:
example
To connect to MongoDB from your applications, use:
- Host:
mongo - Port:
27017 - Connection string:
mongodb://root:example@mongo:27017
MongoDB includes mongo-express, a web-based admin interface for managing your databases.
Access it at: http://localhost:8081
dev consoleThen in your application:
$client = new MongoDB\Client("mongodb://root:example@mongo:27017");
$database = $client->mydatabase;
$collection = $database->mycollection;Access the MongoDB shell:
dev exec mongo mongosh -u root -p exampleIf MongoDB isn't starting, make sure the configuration marker exists:
ls conf/mongoIf the directory doesn't exist, create it and rebuild:
mkdir -p conf/mongo
dev down
dev up