Service type
MongoDB service
Self-hosted MongoDB document database service for applications that store and query JSON-like documents inside a stack.
You add this service to a stack, where you choose its version and resources. Each app environment can override them.
On Wodby
How MongoDB runs on Wodby
Database, user and passwords
Wodby manages the database and its user; the application does not create them.
- One database and one user are created for the environment, both named after the application and the environment.
- The user is created in the
admindatabase and has thereadWriterole on the environment's database only. A client therefore authenticates againstadmin(authSource=admin), not against the application database. Authenticating against the application database is the usual reason a correct password is refused. - Wodby creates the database by creating a collection named
__wodbyin it. Leave that collection in place. - The administrator is
root(MONGO_INITDB_ROOT_USERNAME,MONGO_INITDB_ROOT_PASSWORDin the container). Its password and the user's password are generated once per environment (tokensroot_passwordandpassword). - Creating the user is safe to repeat. A user of the same name that accepts the generated password is kept. One with a different password is left unchanged and the creation fails, so a password changed inside MongoDB is never reset.
How a linked service reaches it
- Host: the name of this app service inside the environment. Port:
27017. - A service linked to this one receives the connection details as environment variables defined by its own link. Read those in the application; do not hardcode them and do not use
rootfrom the application. - A connection URL that Wodby builds for a link already carries
authSource=admin. A URL assembled in the application from host, port, user and password has to add it.
Data, backups and imports
- Data is on the
datavolume, mounted at/data/db. The service runs a single instance. - The backup is a
.tar.gzholding a gzippedmongodumparchive of the environment's database and a restore script. - The database import takes a
.tar.gzor.tgzbackup made by this service. - The manifest declares no configuration settings; the server runs with the image's defaults.
Check the result
In the database container, mongosh --quiet -u "$MONGO_INITDB_ROOT_USERNAME" -p "$MONGO_INITDB_ROOT_PASSWORD" --authenticationDatabase admin --eval 'db.adminCommand({listDatabases: 1})' lists the databases.
Overview
Technical profile of MongoDB
Versions
Source repository
Public Helm chart
Persistent volumes
Database page
Stacks
Stacks that include MongoDB
Data
Backups and data import for MongoDB
Manual and scheduled backups
Run a backup when you need one, or set a schedule in a backup preset.
Import from an archive, a URL, or a backup
An import takes an uploaded archive, a public URL, or a completed backup of a compatible service.
Where archives are stored
Wodby writes each archive to Wodby Blob Storage or to a bucket at a storage provider that you connect as an integration.
Configuration
MongoDB service configuration
Volumes