briqbriq
Dashboard

cookbook / mongo

MongoDB

A MongoDB server with authentication and a persistent volume.

Run it

briq_run({
  recipe: "mongo",
  params: {
    "version": "8",
    "size": "small"
  },
  wait: true
})

Parameters

NameTypeOptionsDefault
versionenum7, 8"8"
sizeenumnano, small, medium, large"small"

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:827017small10 GB at /data/db

When to use it

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

Authentication is on: the output URI carries the generated root password and authSource=admin. Versions 7 and 8 (default).

Tips

  • One database per test run. The URI points at app; use a different database name per suite if you run several in parallel against the same briq.
  • Seed with mongosh. briq_files_put a script to /seed.js, then briq_exec with mongosh "$MONGODB_URI" /seed.js.
  • Transactions need a replica set. The recipe runs a single node without replication. If your code requires session.startTransaction(), ask in the cookbook issues for the replicaSet parameter.
  • Data survives stop/start thanks to the 10 GB volume at /data/db.