Back to tools

AI Agent Tool

MongoDB logo

MongoDB

Document-oriented NoSQL database with flexible schema and cloud-managed Atlas service.

Database PlatformCommunity

mongodb.com

•

One-click Login

About MongoDB

MongoDB is a general-purpose, document-oriented NoSQL database that stores data as BSON (JSON-like) documents, allowing flexible and evolving schemas without rigid table structures. It is widely used for web applications, real-time analytics, content management, and AI/vector search workloads. MongoDB Atlas is the fully managed cloud offering (available on AWS, GCP, and Azure), while MongoDB Enterprise Advanced is a self-managed option for on-premises or private cloud deployments. Atlas includes built-in full-text search, vector search, stream processing, and an App Services layer.

AI Agent Use Cases

- Flexible document model (BSON/JSON) with dynamic schema

- Horizontal scaling via native sharding and automatic failover with replica sets

- MongoDB Atlas: fully managed cloud database on AWS, GCP, and Azure

- Atlas Vector Search for AI/semantic search use cases

- Client-side field-level encryption, LDAP/Kerberos auth, and audit logging (Enterprise)

- Atlas Stream Processing for real-time event-driven data pipelines

Available Actions

These are the specific actions that AI agents can perform with this tool

Inputs

database

The name of the MongoDB database where the target collection resides.

collection

The name of the collection to search within the specified database.

query

Optional MongoDB query filter specifying criteria for matching documents. If omitted or set to an empty object, all documents in the collection are matched. Most query selectors are supported except for evaluation, geospatial, and bitwise selectors (these are only allowed in system functions).

projection

Optional projection document specifying which fields to include (value 1) or exclude (value 0) from the results. Do not mix inclusion and exclusion for different fields except for the `_id` field, which can always be excluded.

options

Additional options for the query, such as 'session'. See MongoDB documentation if a transactional session is required.

access_token

OAuth2 access token obtained from https://cloud.mongodb.com/api/oauth/token. Must be provided in the Authorization header for authentication.

Inputs

database

Specifies the name of the database containing the collection to search. Must be an existing MongoDB database name.

collection

Specifies the name of the collection in the database to search. Must be an existing collection within the database.

query

A MongoDB query filter that defines which documents to return. Specify as an object; use an empty object {} or omit to match all documents. Most query selectors supported except evaluation, geospatial, or bitwise selectors, which are only for system functions.

projection

A MongoDB projection specifying which fields to include (1) or exclude (0) in the results. You may specify either fields to include OR to exclude (not both), except you can always exclude _id. If omitted, all fields are returned.

options

Additional configuration options, such as the ClientSession object for transaction contexts.

access_token

OAuth 2.0 Bearer access token obtained from https://cloud.mongodb.com/api/oauth/token. Pass this as an Authorization header value: 'Bearer {access_token}'.

Inputs

database

The name of the database containing the target collection.

collection

The name of the collection from which to find a single document.

query

The query selection criteria as a document (JSON object) using MongoDB query operators. If omitted, all documents are eligible.

projection

Document specifying fields to return, using projection operators. Either all included or all excluded (except _id is special). Omit for all fields.

options

Additional options for the query such as sort, let, and others accepted by the MongoDB findOne operation.

access_token

OAuth 2 Bearer access token authorized for the MongoDB API. Pass exactly as received from 'https://cloud.mongodb.com/api/oauth/token'.

Inputs

database

The target database name where the collection is located.

collection

The name of the collection to run the findOne operation against.

query

A document describing the selection filter using MongoDB query operators. Returns the first document matching this filter. If omitted, matches any document.

projection

Specifies which fields to include or exclude using projection operators. If omitted, all fields will be returned.

options

Additional options for the query, such as sort order, collation, or let variables. See FindOptions in MongoDB documentation for details.

access_token

A valid OAuth 2.0 Bearer access token obtained from https://cloud.mongodb.com/api/oauth/token using the necessary scopes.

Inputs

database

The name of the database where the target collection is located.

collection

The name of the collection into which to insert the documents.

documents

An array of documents to insert into the collection. Each must be a valid JSON object; can include optional or explicit _id keys.

writeConcern

A document defining the write concern (level of acknowledgment requested). Use only if not running inside a transaction.

ordered

Whether to insert documents in order. If true, the operation stops at the first error; if false, the operation continues with remaining inserts.

Inputs

database

Name of the database where the target collection resides.

collection

Name of the collection where the document will be inserted.

document

The document to insert into the collection. If '_id' is not specified, one will be generated automatically.

writeConcern

Optional write concern settings for the operation, such as 'w', 'j', or 'wtimeout'. Omit or set to null to use the default write concern. In a transaction, do not explicitly set this.

access_token

OAuth Bearer token used for authentication. Must be set in the 'Authorization' HTTP header for the request.

Inputs

database

Name of the MongoDB database containing the collection to insert into.

collection

Name of the MongoDB collection into which the document will be inserted.

document

The document to insert into the collection. Must be a dictionary. '_id' field can be specified for a custom unique identifier or omitted to let MongoDB generate one.

writeConcern

Optional. Specifies the write concern for the operation. Omit when running inside a transaction.

access_token

OAuth2 Bearer token that authenticates the API request. Should be retrieved via MongoDB Cloud OAuth endpoints as documented.

Inputs

appId

The unique application ID identifying your specific Atlas App for which to list available Data API endpoints. It must be supplied in the base URL of the request.

apiVersion

The Data API version to target (e.g. 'v1'). This is specified in the endpoint URL and must match a version enabled for your app.

access_token

The OAuth 2.0 access token acquired from the MongoDB Cloud OAuth endpoints. It must be passed in the 'Authorization: Bearer {access_token}' header for authentication.

Inputs

database

The name of the MongoDB database that contains the target collection.

collection

The name of the MongoDB collection on which to perform the updateMany operation.

filter

A document describing the filter to match the documents that should be updated. Use MongoDB query syntax; an empty object `{}` matches all documents.

update

Specifies the updates to apply. It must be either: a document containing only update operators (e.g., {$set: {...}, $inc: {...}}), or an array representing an aggregation pipeline with permitted stages.

upsert

When true, inserts a new document if no documents match the filter. Defaults to false.

writeConcern

Optional. Specifies the write concern for the operation, e.g., {'w': 'majority', 'wtimeout': 100}. Omit when running in a transaction.

collation

Optional. A document specifying language-specific rules for string comparison (collation). Must at least include the field 'locale'.

arrayFilters

Optional. Array of filter documents to determine which array elements to modify if updating within array fields using filtered positional operators.

hint

Optional. Index to use for the query predicate. Specify either as a document (e.g., {field: 1}) or as a string (index name). If the index does not exist, the operation fails.

let

Optional. A document defining parameter values for use within the filter or update using '$$' variable access in MongoDB expressions.

access_token

The OAuth2 Bearer token, obtained using the MongoDB Cloud OAuth flow, to authorize and authenticate the API call.

Inputs

database

The name of the database in which the collection resides.

collection

The name of the collection to update a document in.

filter

The filter used to select the document to update. Uses the same query selectors as the find() method. For example: {"name": "Central Perk Cafe"}

update

The update to apply to the matched document. Must be either an update document with update operators or a list representing an aggregation pipeline.

upsert

If true, creates a new document if no documents match the filter. Defaults to false.

writeConcern

Specifies the write concern for the operation (e.g., {'w': 'majority', 'wtimeout': 100}). Omit to use the default. Do not use if run in a transaction.

collation

Determines the collation rules for string comparison (e.g., { 'locale': 'fr', 'strength': 1 }). Must include 'locale' field if provided.

arrayFilters

An array of filter documents that determine which array elements to modify for an update operation. Required if the update document uses filtered positional operator ($[<identifier>]).

hint

A document or string that specifies the index to use to support the query predicate. Causes an error if the index does not exist.

let

A document mapping variable names to expressions, which can be used within the filter or update.

sort

Determines which document the operation updates if the query selects multiple documents. Only one document is updated, and the one at the top of this sort order is chosen.