Graphrt

MongoDB

Find, count, distinct dan aggregate dengan Extended JSON, daftar database dan collection, insert, update, replace dan delete. Tool agent hanya membaca kecuali diizinkan, tidak pernah JavaScript di sisi server

Stabil v0.1.0 Node.js 14 aksi
Pakai di Graphrt Desktop

Tentang

Plugin Graphrt untuk MongoDB yang dibangun di atas driver mongodb resmi. Plugin ini meng-query dan meng-aggregate collection, menampilkan database dan collection, serta meng-insert, mengubah, mengganti dan menghapus dokumen. Nilai melewati batas plugin sebagai Extended JSON (relaxed), jadi ObjectId, tanggal dan desimal tetap utuh di kedua arah.

Yang bisa dilakukan

  • 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.

Aksi

Setiap aksi adalah langkah yang bisa ditambahkan ke workflow. Agent juga bisa memakai sebagian besar aksi sebagai tool.

  • 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
Tampilkan semua 14 aksi
  • Update documents mongodb.update_many
  • Replace document mongodb.replace_one
  • Delete document mongodb.delete_one
  • Delete documents mongodb.delete_many

Pengaturan

Graphrt menyalakan plugin dengan environment yang bersih. Hanya nilai ini yang sampai ke plugin, dan secret tidak masuk log.

  • 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

Cara memakainya

Di Graphrt Desktop

  1. Buka Plugins dan cari MongoDB.
  2. Klik Install lalu setujui.
  3. Ikuti langkah setup di halaman plugin, lalu tempel pengaturan yang dibutuhkan.
  4. Jelaskan pekerjaan yang membutuhkannya, dan builder menambahkan langkahnya.
Plugin di Graphrt Desktop

Dengan 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" } } }
Plugin di docs