Setup
Get a connection URI for a user that can read the databases. Then export it:Get a connection URI
Get a connection URI
- Local server:
mongodb://localhost:27017. - Self-hosted with auth:
mongodb://<username>:<password>@<host>:27017/?authSource=admin. - MongoDB Atlas:
- Open the project’s Clusters page and select Connect on the cluster.
- Add the application host’s IP address to the access list (also under Network Access).
- Create a database user. The built-in Only read any database role
is enough, or
readon the databases the mount should see. - Select Drivers and copy the
mongodb+srv://string. - Put the user’s password in place of
<db_password>, percent-encoding reserved characters such as@(%40).
pip install "mirage-ai[mongodb]"; Node needs the mongodb peer
dependency (pnpm add @struktoai/mirage-node mongodb).
Connect
- YAML
- Python
- TypeScript
workspace.yaml
Layout
databaseslimits the tree to those databases. Unset, it shows all butadmin,configandlocal.documents.jsonlholds one document per line in Relaxed Extended JSON;schema.jsonholds field types from the first 100 documents, the indexes and any validator.tail -npastmax_doc_limit(5,000) documents fails withFile too large.elide_fieldsdrops heavy fields such as embeddings.
Sample runs
grep fetches only the documents that may match, and wc -l counts on the
server. The mount is read-only: no command changes the database.
SDK guides
Python
Every config field, the VFS.md and write support.
TypeScript
Every config field, the VFS.md and write support.