/mongodb | Type: Application | PCID required: Yes
MongoDB API
Tools
| Tool | Description |
|---|---|
mongodb_find | Find multiple documents in a MongoDB collection matching the given filter. Returns an array of documents. |
mongodb_find_one | Find a single document in a MongoDB collection matching the given filter. Returns the first matched document or null. |
mongodb_insert_one | Insert a single document into a MongoDB collection. |
mongodb_insert_many | Insert multiple documents into a MongoDB collection in a single operation. |
mongodb_update_one | Update the first document in a MongoDB collection that matches the filter. Use MongoDB update operators like unset, push. |
mongodb_update_many | Update all documents in a MongoDB collection that match the filter. Use MongoDB update operators like unset, push. |
mongodb_delete_one | Delete the first document in a MongoDB collection that matches the filter. |
mongodb_delete_many | Delete all documents in a MongoDB collection that match the filter. |
mongodb_aggregate | Execute an aggregation pipeline on a MongoDB collection. Supports read-only stages such as group, project, unwind, skip. Note: merge stages write data to collections and should be used with caution. |
mongodb_count_documents | Count the number of documents in a MongoDB collection matching the given filter. |
mongodb_list_collections | List all collections in the connected MongoDB database. |
mongodb_describe_collection | Infer the schema of a MongoDB collection by sampling documents. Returns field names and their detected BSON types. |
mongodb_get_info | Get information about the connected MongoDB database. |
mongodb_find
Find multiple documents in a MongoDB collection matching the given filter. Returns an array of documents. Parameters:| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
collection | string | Yes | — | Collection name |
filter | object | No | — | MongoDB query filter (e.g. { “status”: “active”, “age”: { “$gt”: 18 } }) |
options | object | No | — | Additional MongoDB operation options (e.g. { “limit”: 10, “sort”: { “name”: 1 } }) |
mongodb_find_one
Find a single document in a MongoDB collection matching the given filter. Returns the first matched document or null. Parameters:| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
collection | string | Yes | — | Collection name |
filter | object | No | — | MongoDB query filter (e.g. { “status”: “active”, “age”: { “$gt”: 18 } }) |
options | object | No | — | Additional MongoDB operation options (e.g. { “limit”: 10, “sort”: { “name”: 1 } }) |
mongodb_insert_one
Insert a single document into a MongoDB collection. Parameters:| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
collection | string | Yes | — | Collection name |
document | object | Yes | — | Document to insert as a key-value object |
options | object | No | — | Additional MongoDB operation options (e.g. { “limit”: 10, “sort”: { “name”: 1 } }) |
mongodb_insert_many
Insert multiple documents into a MongoDB collection in a single operation. Parameters:| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
collection | string | Yes | — | Collection name |
documents | object[] | Yes | — | Array of documents to insert |
options | object | No | — | Additional MongoDB operation options (e.g. { “limit”: 10, “sort”: { “name”: 1 } }) |
mongodb_update_one
Update the first document in a MongoDB collection that matches the filter. Use MongoDB update operators like unset, push. Parameters:| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
collection | string | Yes | — | Collection name |
filter | object | Yes | — | Filter to identify the document to update |
update | object | Yes | — | MongoDB update document using update operators (e.g. { “set": { "field": "value" }, "inc”: { “count”: 1 } }) |
options | object | No | — | Additional MongoDB operation options (e.g. { “limit”: 10, “sort”: { “name”: 1 } }) |
mongodb_update_many
Update all documents in a MongoDB collection that match the filter. Use MongoDB update operators like unset, push. Parameters:| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
collection | string | Yes | — | Collection name |
filter | any | Yes | — | Filter to identify documents to update. Must contain at least one condition; use mongodb_find first to verify scope. |
update | object | Yes | — | MongoDB update document using update operators (e.g. { “set": { "field": "value" }, "inc”: { “count”: 1 } }) |
options | object | No | — | Additional MongoDB operation options (e.g. { “limit”: 10, “sort”: { “name”: 1 } }) |
mongodb_delete_one
Delete the first document in a MongoDB collection that matches the filter. Parameters:| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
collection | string | Yes | — | Collection name |
filter | object | Yes | — | Filter to identify the document to delete |
options | object | No | — | Additional MongoDB operation options (e.g. { “limit”: 10, “sort”: { “name”: 1 } }) |
mongodb_delete_many
Delete all documents in a MongoDB collection that match the filter. Parameters:| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
collection | string | Yes | — | Collection name |
filter | any | Yes | — | Filter to identify documents to delete. Must contain at least one condition; use mongodb_find first to verify scope. |
options | object | No | — | Additional MongoDB operation options (e.g. { “limit”: 10, “sort”: { “name”: 1 } }) |
mongodb_aggregate
Execute an aggregation pipeline on a MongoDB collection. Supports read-only stages such as group, project, unwind, skip. Note: merge stages write data to collections and should be used with caution. Parameters:| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
collection | string | Yes | — | Collection name |
pipeline | object[] | Yes | — | Aggregation pipeline stages (e.g. [{ “match": { "status": "active" } }, { "group”: { “_id”: “category", "total": { "sum”: 1 } } }]) |
options | object | No | — | Additional MongoDB operation options (e.g. { “limit”: 10, “sort”: { “name”: 1 } }) |
mongodb_count_documents
Count the number of documents in a MongoDB collection matching the given filter. Parameters:| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
collection | string | Yes | — | Collection name |
filter | object | No | — | MongoDB query filter (e.g. { “status”: “active”, “age”: { “$gt”: 18 } }) |
options | object | No | — | Additional MongoDB operation options (e.g. { “limit”: 10, “sort”: { “name”: 1 } }) |
mongodb_list_collections
List all collections in the connected MongoDB database.mongodb_describe_collection
Infer the schema of a MongoDB collection by sampling documents. Returns field names and their detected BSON types. Parameters:| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
collection | string | Yes | — | Collection name to inspect |

