MongoDB

Store and query documents in a persistent MongoDB database.

  • database
  • document

Guide: Connect to a database from outside

Run it

briq run mongo

Fields

NameTypeOptionsDefault
imagestring—"mongo:8"
envrecord{ key: string | { secret, value?, literal?, scope?, hosts?, locations? } }{}
cmdstring | string[]——
sizeenumpico, micro, nano, small, medium, large, xlarge"small"
volumeobject{ gb? }{"gb":2}
filesrecord{ key: string | { base64 } }—
egressobject{ hosts }—

Outputs

Returned by briq_run once the stack is healthy. Hosts resolve inside your team network; secrets are generated per run.

MONGODB_URI
mongodb://root:<MONGO_ROOT_PASSWORD>@mongo.<stack>.internal:27017/app?authSource=admin
MONGO_HOST
mongo.<stack>.internal
MONGO_USER
root
MONGO_PASSWORD
<MONGO_ROOT_PASSWORD>

What it runs

BriqImagePortsSizeVolume
mongomongo:827017small2 GB at /data/db

When to use it

  • Your code uses Mongoose, Prisma with MongoDB or the native driver, and needs the real server: indexes, aggregation, validation.
  • Tests expect MONGODB_URI.

Tips

  • Auth is on: the URI carries the generated root password and authSource=admin.
  • No transactions: it is a single node, not a replica set, so session.startTransaction() fails.
  • One database per suite when several run in parallel against the same briq.
  • Seed with mongosh: briq_files_put a script to /seed.js, then briq_exec with sh -c 'mongosh -u root -p "$MONGO_INITDB_ROOT_PASSWORD" app /seed.js'.
  • Connect from outside: briq_expose port 27017 with protocol: "mongodb", for mongosh or Compass. See Connect to a database from outside.
  • Bigger dataset? The volume starts small: set volume: { gb: 20 }. Set it when the briq is created, and it counts toward your plan's disk.

On this page

Free to try

Try briq, on us.

Every new account starts with €10 of credits. No card.

Start building

How can we help?

Message to the briq team