Skip to content

MongoDB & Redis

The non-SQL engines get their own runners, shaped to their data model rather than forced into a table grid. Browsing both is covered in Browsing your data; this page is about running commands.

Both runners require the Editor role and are recorded in the db_query_log audit table.

The Mongo Shell runs an arbitrary mongosh script against the selected database. It’s a collapsible panel below the collection browser, closed by default.

  • Pier prefixes your script with db = db.getSiblingDB("<selected database>"), so db refers to the database you picked — then runs the rest verbatim.
  • Scripts execute through mongosh inside the service container (via docker-exec), authenticating as the root user from the service’s encrypted env. There’s no native Mongo driver in the Pier binary.
  • The shell’s textual output is returned as-is, so print(...), printjson(...) and the implicit result of an expression all show up.

Example scripts:

// count documents in a collection
db.getCollection("orders").countDocuments({ status: "paid" })
// find with a projection
db.getCollection("users").find({ active: true }, { email: 1 }).limit(5).toArray()
// an aggregation
db.getCollection("events").aggregate([
{ $group: { _id: "$type", n: { $sum: 1 } } },
{ $sort: { n: -1 } }
]).toArray()

For read-only browsing (databases, collections, paginated documents as EJSON) you only need Viewer — see Browsing your data.

The Redis view pairs the key browser with a command box that runs a single raw command and renders the reply as JSON.

  • Type a command like GET mykey, HGETALL session:42 or TTL token:abc and run it.
  • The command line is tokenized with double-quote support, so SET greeting "hello world" keeps the quoted argument intact.
  • Replies are converted to JSON: bulk strings, integers, arrays/sets, maps and OK all map to their natural JSON shape.
  • The selected database index (0–15) applies to the command, the same as the key browser.

Reads through the key browser (SCAN, type-aware GET/LRANGE/HGETALL/…, TTL) need only Viewer; running an arbitrary command needs Editor, since a command can mutate or delete data.

  • Access & audit — roles and the db_query_log audit log.
  • Overview — supported engines and how Pier connects.