MongoDB
Introduction
MongoDB is a popular open-source NoSQL database program. It is known for its flexibility, scalability, and performance, particularly in handling large volumes of data and in applications where data structures can change over time.
Deploy MongoDB within the Dev Container
Like saw inProject Preparation - Backend API, the Dev Container is configured to use a Docker compose file. So MongoDB container could be easily deploy with the Dev Container.
To add MongoDB to the Docker compose file, modify the file docker-compose.yml as following:
services:
devcontainer:
image: mcr.microsoft.com/devcontainers/dotnet:1-8.0-bookworm
volumes:
- ../..:/workspaces:cached
- ~/.aspnet/https:/home/vscode/.aspnet/https
network_mode: service:mongo
command: sleep infinity
mongo:
image: mongo:7.0.4
restart: unless-stopped
mongo-express:
image: mongo-express
ports:
- :8081
restart: unless-stopped
mongo-express is a web-based MongoDB admin interface written with Node.js, Express, and Bootstrap3. The mongo-express’s port is random, so check your Docker server you find out at which port the container has been set. The default username and password are admin and pass.
Learn more about mongo-express