Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.mirage.strukto.ai/llms.txt

Use this file to discover all available pages before exploring further.

MongoDBResource exposes a MongoDB connection as a read-only filesystem: databases at the top level, collections inside, individual documents at the leaves. Setup steps for the connection URI live at MongoDB Credentials.

Node

pnpm add @struktoai/mirage-node mongodb
import { MongoDBResource, MountMode, Workspace } from '@struktoai/mirage-node'

const mongo = new MongoDBResource({
  uri: process.env.MONGO_URI!,
  databases: ['app', 'analytics'],
})

const ws = new Workspace({ '/mongo': mongo }, { mode: MountMode.READ })
await ws.execute('ls /mongo/app/users/')

Browser

pnpm add @struktoai/mirage-browser
The browser variant routes Mongo operations through an HTTP driver (no direct DB connection from the page). The browser examples ship a mongo_proxy Vite plugin that forwards to a server-side mongodb driver:
import { MongoDBResource, MountMode, Workspace } from '@struktoai/mirage-browser'

const mongo = new MongoDBResource({
  uri: 'mongodb-proxy://app',
  httpDriver: { fetch: window.fetch },
})

Config

FieldDefaultNotes
urirequiredMongo connection URI. Redacted in snapshots.
databasesnoneOptional allowlist of database names.
defaultDocLimit100Default page size for ad-hoc reads.
defaultSearchLimit100Default page size for search-style queries.
maxDocLimit10_000Hard ceiling per read.

Mount mode

read. For the database/collection/document layout see the Python MongoDB docs.