Graphrt

MongoDB

Find, count, distinct and aggregate with Extended JSON, list databases and collections, insert/update/replace/delete, agent tools read-only unless opted in, never server-side JavaScript

Stable v0.1.0 Node.js 14 actions
Use in Graphrt Desktop

About

A Graphrt plugin for MongoDB, built on the official mongodb driver. It queries and aggregates collections, lists databases and collections, and inserts, updates, replaces and deletes documents. Values cross the plugin boundary as Extended JSON (relaxed), so ObjectIds, dates and decimals survive the trip both ways.

What it can do

  • Reading: find (filter, projection, sort, limit up to 1000, skip or cursor paging), find_one, count, distinct and aggregate.
  • Discovery: list_databases and list_collections.
  • Writing: insert_one, insert_many (up to 1000), update_one, update_many, replace_one, delete_one and delete_many.
  • Extended JSON: filters and documents may use {"$oid": "…"}, {"$date": "2026-11-19T00:00:00Z"}, {"$numberDecimal": "10.50"}, {"$numberLong": "…"} and the other EJSON types. Results come back the same way.
  • Bounded work: queries, aggregations and writes have a server-side max_time_ms (default 15 s, max 60 s). Results are capped at 1000 documents and MONGODB_MAX_RESULT_BYTES, and truncated / has_more say when a cap was hit.
  • Agent-safe by default: agent tool calls are read-only unless you opt in, may only use allowlisted operators (never server-side JavaScript) and only the databases you allow (see Safety).
  • Every operation is a node mongodb.<operation> and an agent tool <operation>. The full reference is in OPERATIONS.md.

Actions

Each action is a step you can add to a workflow. Agents can also use most of them as tools.

  • Find documents mongodb.find
  • Find one document mongodb.find_one
  • Count documents mongodb.count
  • Distinct values mongodb.distinct
  • Aggregate mongodb.aggregate
  • List databases mongodb.list_databases
  • List collections mongodb.list_collections
  • Insert document mongodb.insert_one
  • Insert documents mongodb.insert_many
  • Update document mongodb.update_one
Show all 14 actions
  • Update documents mongodb.update_many
  • Replace document mongodb.replace_one
  • Delete document mongodb.delete_one
  • Delete documents mongodb.delete_many

Settings

Graphrt starts plugins with a clean environment. Only these values reach the plugin, and secrets stay out of logs.

  • MONGODB_URL (required)
    Connection string, mongodb://user:password@host:27017/shop?authSource=admin or mongodb+srv://…. A node's access_token (from a secret, with --trust-plugin mongodb) overrides it. The password is redacted from every error and log line.
  • MONGODB_DATABASE Database in the URL path
    Default database when an operation has no database
  • MONGODB_TOOL_ALLOW_WRITES (off)
    1 lets agent tool calls run the write operations and $merge pipelines. Workflow nodes can always write.
  • MONGODB_TOOL_ALLOWED_DATABASES (none)
    Databases agent tool calls may use besides the default one, comma-separated (e.g. crm,reports), or * for any database except admin, local and config. Workflow nodes may use any database.
  • MONGODB_MAX_RESULT_BYTES 1000000
    Extended JSON bytes one read may return (max 8000000)
  • MONGODB_IDLE_MINUTES 5
    Close the pooled connection after this many idle minutes

How to use it

In Graphrt Desktop

  1. Open Plugins and search for MongoDB.
  2. Click Install and approve it.
  3. Follow the setup steps on the plugin's page, then paste the settings it needs.
  4. Describe a job that needs it, and the builder adds the steps.
Plugins in Graphrt Desktop

With the CLI

terminal
$ graphrt plugin install mongodb
workflow.yaml
- id: recent
  type: mongodb.find
  collection: orders
  filter: { status: paid, created: { $gte: { $date: "2026-11-01T00:00:00Z" } } }
  projection: { _id: 1, number: 1, total: 1 }
  sort: { created: -1 }
  limit: 50
- id: by_city
  type: mongodb.aggregate
  collection: orders
  pipeline:
    - { $match: { status: paid } }
    - { $group: { _id: "$city", total: { $sum: "$total" }, orders: { $sum: 1 } } }
    - { $sort: { total: -1 } }
- id: mark_shipped
  type: mongodb.update_one
  collection: orders
  filter: { number: "{{#recent.data.documents.0.number#}}" }
  update: { $set: { status: shipped, shipped_at: { $date: "2026-11-19T10:00:00Z" } } }
Plugins in the docs