MongoDB¶
MongoDB is an alternative storage backend for Console — a drop-in replacement for the default SQLite / PostgreSQL SQL backends. Switching is a configuration change only: no code change, no schema migration. The repository interfaces are identical across backends, so the use-case and HTTP layers are unaware of which one is in use.
API compatibility
The MongoDB backend is fully API-compatible with the SQL backends. Everything available through the Console UI or REST API behaves the same on either backend. Data does not migrate automatically between backends.
Selecting the backend¶
Set DB_PROVIDER=mongo (or db.provider: mongo in config.yml) and supply a
DB_URL such as mongodb://user:pass@host:27017/?authSource=admin. See the
Database overview for how DB_PROVIDER chooses among all
backends.
Notes:
DB_POOL_MAXis honored only by the SQL backends. The MongoDB driver manages its own connection pool, configured throughDB_URLoptions such asmaxPoolSize. See MongoDB connection string options for the full list.
Source paths in this section
File paths and CI workflow references in the pages that follow (e.g.,
internal/usecase/nosqldb/mongo/, internal/app/repos.go,
.github/workflows/api-test.yml) refer to the
Console source repository, not to this docs repo.
Next steps¶
- Quick Start with Docker Compose — bring up the bundled
mongoservice, point Console at it, and verify the deployment. - Collections and Indexes — what Console creates inside the
consoledbdatabase. - Schema Changes — the bookkeeping each backend needs when an entity changes.
- Adding a New NoSQL DB — extending the
nosqldbpackage with another backend.