MongoDB
DatabaseConnect AI agents to MongoDB and MongoDB Atlas. Agents run the full document lifecycle, aggregation pipelines, collection and index management, and Atlas vector search.
What This Integration Enables
Agents read, insert, update, and delete documents, run aggregation pipelines for reporting steps, and manage collections and indexes. On MongoDB Atlas (v6.0.11+ or MongoDB 8.2+ with Atlas Search), agents also run Vector Search and manage search indexes, which turns a collection into a retrieval source for AI steps. Update Document and Update Documents wrap plain field objects in `$set` automatically, so `{"status":"archived"}` updates one field instead of replacing the whole document; Replace Document is the explicit path for a full replacement. The connect-per-call model keeps each operation isolated.
Without FlowRunner
With FlowRunner
Use Case Scenarios
Reporting rollups from a live collection
An agent runs Aggregate with a `$match` and `$group` pipeline to compute daily order totals, reads the result, and writes it back to a per-tenant config document with Update Document so the application can read the summary directly. The rollup that used to be a manual shell command now runs on schedule inside the flow.
Retrieval for an AI step (Atlas)
On an Atlas cluster, an agent embeds an incoming question, runs Vector Search against a pre-created vector index, and passes the nearest documents to a downstream AI step as grounding context. The collection becomes a governed retrieval source without a separate vector store.
Cleanup with a human gate
An agent identifies stale documents to remove. Before it runs Delete Documents or Drop Collection, it does not act on its own. It routes the proposed cleanup for approval and runs it only after a person confirms.
Human-in-Loop Highlight
The safety rule that matters most in MongoDB is the empty filter: a Delete Documents or Update Documents with no filter would touch every document in the collection, and Drop Collection removes a collection outright. FlowRunner's answer is human-in-the-loop, an execution pattern where the agent pauses on its own, assembles the context and the choices, routes to a human on their preferred channel, and resumes the moment they respond. When an Update Documents or Delete Documents would affect more documents than the configured threshold, or when a flow reaches Drop Collection, the agent pauses and asks through Slack: "This Delete Documents on `sessions` matches 12,400 documents. Here is the filter and a sample. Approve, narrow the filter, or cancel?" The operation runs only after a person confirms, with the approver and timestamp captured in the run log. A connector can run any command; an orchestration layer knows which commands should stop and ask.
Agent Capabilities
22 actionsDocuments
9- Find Documents Queries with full MongoDB filter syntax, projection, sorting, and limit and skip pagination (default limit 100).
- Find One Document Returns the first matching document, or `null`, with optional projection.
- Insert Document Inserts one document and returns the generated `_id` as a string.
- Insert Documents Bulk-inserts an array of documents in a single call.
- Update Document Updates the first matching document with update operators; plain field objects are auto-wrapped in `$set`, with optional upsert.
- Update Documents Updates all matching documents. A non-empty filter is required.
- Replace Document Replaces the entire matched document with a new one, for intentional full replacement.
- Delete Document Deletes the first matching document. A non-empty filter is required.
- Delete Documents Deletes all matching documents. A non-empty filter is required.
Aggregation
3- Count Documents Counts documents matching a filter; an empty filter counts all.
- Distinct Values Returns the distinct values of a field across matching documents, with dot notation supported.
- Aggregate Runs an aggregation pipeline with `allowDiskUse: true`, for reporting and analytics steps.
Collections
3- List Collections Lists all collections and views in the database with their types.
- Create Collection Explicitly creates a collection.
- Drop Collection Permanently deletes a collection with all its documents and indexes. This cannot be undone.
Indexes
2- Create Index Creates an index from a keys spec with options such as `unique`, `sparse`, and `expireAfterSeconds` for TTL.
- List Indexes Lists all indexes on a collection.
Vector Search
5- Vector Search Runs an Atlas `$vectorSearch` query and returns the nearest documents to a query vector, each annotated with a relevance score. Requires a pre-created vector search index on Atlas.
- Create Search Index Creates an Atlas Search or Vector Search index from a fields definition. Index builds are asynchronous.
- List Search Indexes Lists all search and vector-search indexes on a collection with name, type, build status, and definition.
- Update Search Index Replaces an existing search index's definition by name; the index is rebuilt asynchronously.
- Drop Search Index Permanently deletes a search index by name. Documents are unaffected.
Start building with MongoDB
$100 in credits. No card required. Connect in minutes.