MongoDB
MongoDB is a source-available, cross-platform, document-oriented database. Query, insert, update and delete documents in your collections.
Categories: Developer Tools
Type: mongodb/v1
Connections
Version: 1
custom
Properties
| Name | Label | Type | Description | Required |
|---|---|---|---|---|
| connectionString | Connection String | STRING | The MongoDB connection string. Supports both standard (mongodb://) and SRV (mongodb+srv://) formats, as well as TLS and authentication options. | true |
| database | Database | STRING | The name of the database to connect to. | true |
| username | Username | STRING | Username for authentication. Leave empty if credentials are in the connection string or no authentication is required. | false |
| password | Password | STRING | Password for authentication. Leave empty if credentials are in the connection string or no authentication is required. | false |
Connection Setup
ByteChef connects to MongoDB using a standard connection string, so both MongoDB Atlas (SRV) and self-hosted deployments are supported.
MongoDB Atlas
- In MongoDB Atlas, open your cluster and click Connect → Drivers.
- Copy the SRV connection string (it looks like
mongodb+srv://cluster0.example.mongodb.net). - Under Database Access, create a database user (username and password).
- Under Network Access, allow your current IP address.
- Enter the connection string, database name and the user's credentials when creating the connection.
Self-hosted
- Use a standard connection string such as
mongodb://host:27017. - Provide the database name and, if authentication is enabled, the username and password.
TLS, X.509 and other advanced authentication options can be supplied directly in the connection string. See the connection string options for details.
Actions
Find
Name: find
Finds documents in a collection matching a filter.
Properties
| Name | Label | Type | Description | Required |
|---|---|---|---|---|
| collection | Collection | STRING | The name of the collection to query. | true |
| filter | Filter | OBJECT Properties{} | The query filter as a JSON object. Leave empty to match all documents. | false |
| projection | Projection | OBJECT Properties{} | The fields to include or exclude as a JSON object, e.g. {"name": 1, "_id": 0}. | false |
| sort | Sort | OBJECT Properties{} | The sort order as a JSON object, e.g. {"createdAt": -1} for descending. | false |
| limit | Limit | INTEGER | The maximum number of documents to return. Leave empty for no limit. | false |
Example JSON Structure
{
"label" : "Find",
"name" : "find",
"parameters" : {
"collection" : "",
"filter" : { },
"projection" : { },
"sort" : { },
"limit" : 1
},
"type" : "mongodb/v1/find"
}Output
Type: ARRAY
Items Type: OBJECT
Properties
| Name | Type | Description |
|---|---|---|
| null |
Output Example
[ { } ]Insert One
Name: insertOne
Inserts a single document into a collection.
Properties
| Name | Label | Type | Description | Required |
|---|---|---|---|---|
| collection | Collection | STRING | The name of the collection to insert into. | true |
| document | Document | OBJECT Properties{} | The document to insert as a JSON object. | true |
Example JSON Structure
{
"label" : "Insert One",
"name" : "insertOne",
"parameters" : {
"collection" : "",
"document" : { }
},
"type" : "mongodb/v1/insertOne"
}Output
Type: OBJECT
Properties
| Name | Type | Description |
|---|---|---|
| insertedId | STRING | The identifier of the inserted document. |
Output Example
{
"insertedId" : ""
}Insert Many
Name: insertMany
Inserts multiple documents into a collection.
Properties
| Name | Label | Type | Description | Required |
|---|---|---|---|---|
| collection | Collection | STRING | The name of the collection to insert into. | true |
| documents | Documents | ARRAY Items[{}] | The documents to insert, each as a JSON object. | true |
Example JSON Structure
{
"label" : "Insert Many",
"name" : "insertMany",
"parameters" : {
"collection" : "",
"documents" : [ { } ]
},
"type" : "mongodb/v1/insertMany"
}Output
Type: OBJECT
Properties
| Name | Type | Description |
|---|---|---|
| insertedCount | INTEGER | The number of documents inserted. |
| insertedIds | ARRAY Items[STRING] | The identifiers of the inserted documents. |
Output Example
{
"insertedCount" : 1,
"insertedIds" : [ "" ]
}Update One
Name: updateOne
Updates a single document in a collection matching a filter.
Properties
| Name | Label | Type | Description | Required |
|---|---|---|---|---|
| collection | Collection | STRING | The name of the collection to update. | true |
| filter | Filter | OBJECT Properties{} | The query filter that selects the document to update, as a JSON object. | true |
| update | Update | OBJECT Properties{} | The update to apply, as a JSON object using update operators, e.g. {"$set": {"status": "active"}}. | true |
| upsert | Upsert | BOOLEAN Optionstrue, false | Whether to insert a new document when no document matches the filter. | false |
Example JSON Structure
{
"label" : "Update One",
"name" : "updateOne",
"parameters" : {
"collection" : "",
"filter" : { },
"update" : { },
"upsert" : false
},
"type" : "mongodb/v1/updateOne"
}Output
Type: OBJECT
Properties
| Name | Type | Description |
|---|---|---|
| matchedCount | INTEGER | The number of documents that matched the filter. |
| modifiedCount | INTEGER | The number of documents that were modified. |
| upsertedId | STRING | The identifier of the upserted document, if any. |
Output Example
{
"matchedCount" : 1,
"modifiedCount" : 1,
"upsertedId" : ""
}Update Many
Name: updateMany
Updates all documents in a collection matching a filter.
Properties
| Name | Label | Type | Description | Required |
|---|---|---|---|---|
| collection | Collection | STRING | The name of the collection to update. | true |
| filter | Filter | OBJECT Properties{} | The query filter that selects the documents to update, as a JSON object. | true |
| update | Update | OBJECT Properties{} | The update to apply, as a JSON object using update operators, e.g. {"$set": {"status": "active"}}. | true |
| upsert | Upsert | BOOLEAN Optionstrue, false | Whether to insert a new document when no document matches the filter. | false |
Example JSON Structure
{
"label" : "Update Many",
"name" : "updateMany",
"parameters" : {
"collection" : "",
"filter" : { },
"update" : { },
"upsert" : false
},
"type" : "mongodb/v1/updateMany"
}Output
Type: OBJECT
Properties
| Name | Type | Description |
|---|---|---|
| matchedCount | INTEGER | The number of documents that matched the filter. |
| modifiedCount | INTEGER | The number of documents that were modified. |
| upsertedId | STRING | The identifier of the upserted document, if any. |
Output Example
{
"matchedCount" : 1,
"modifiedCount" : 1,
"upsertedId" : ""
}Delete One
Name: deleteOne
Deletes a single document from a collection matching a filter.
Properties
| Name | Label | Type | Description | Required |
|---|---|---|---|---|
| collection | Collection | STRING | The name of the collection to delete from. | true |
| filter | Filter | OBJECT Properties{} | The query filter that selects the document to delete, as a JSON object. | true |
Example JSON Structure
{
"label" : "Delete One",
"name" : "deleteOne",
"parameters" : {
"collection" : "",
"filter" : { }
},
"type" : "mongodb/v1/deleteOne"
}Output
Type: OBJECT
Properties
| Name | Type | Description |
|---|---|---|
| deletedCount | INTEGER | The number of documents deleted. |
Output Example
{
"deletedCount" : 1
}Delete Many
Name: deleteMany
Deletes all documents from a collection matching a filter.
Properties
| Name | Label | Type | Description | Required |
|---|---|---|---|---|
| collection | Collection | STRING | The name of the collection to delete from. | true |
| filter | Filter | OBJECT Properties{} | The query filter that selects the documents to delete, as a JSON object. | true |
Example JSON Structure
{
"label" : "Delete Many",
"name" : "deleteMany",
"parameters" : {
"collection" : "",
"filter" : { }
},
"type" : "mongodb/v1/deleteMany"
}Output
Type: OBJECT
Properties
| Name | Type | Description |
|---|---|---|
| deletedCount | INTEGER | The number of documents deleted. |
Output Example
{
"deletedCount" : 1
}Aggregate
Name: aggregate
Runs an aggregation pipeline against a collection.
Properties
| Name | Label | Type | Description | Required |
|---|---|---|---|---|
| collection | Collection | STRING | The name of the collection to aggregate. | true |
| pipeline | Pipeline | ARRAY Items[{}] | The aggregation pipeline, an ordered list of stages, each as a JSON object, e.g. {"$match": {"active": true}}. | true |
Example JSON Structure
{
"label" : "Aggregate",
"name" : "aggregate",
"parameters" : {
"collection" : "",
"pipeline" : [ { } ]
},
"type" : "mongodb/v1/aggregate"
}Output
Type: ARRAY
Items Type: OBJECT
Properties
| Name | Type | Description |
|---|---|---|
| null |
Output Example
[ { } ]Triggers
New Document
Name: newDocument
Triggers when a new document is added to a collection.
Type: POLLING
Properties
| Name | Label | Type | Description | Required |
|---|---|---|---|---|
| collection | Collection | STRING | The name of the collection to watch. | true |
| orderBy | Order By Field | STRING | The field used to detect new documents. Use a monotonically increasing field such as _id or a creation timestamp. | true |
Output
Type: ARRAY
Items Type: OBJECT
Properties
| Name | Type | Description |
|---|---|---|
| null |
JSON Example
{
"label" : "New Document",
"name" : "newDocument",
"parameters" : {
"collection" : "",
"orderBy" : ""
},
"type" : "mongodb/v1/newDocument"
}Additional Instructions
Filters, documents and pipelines
Properties such as Filter, Update, Document and the Pipeline stages are expressed as JSON objects that map directly to MongoDB's query language.
- Filter uses query operators,
e.g.
{"age": {"$gte": 18}, "active": true}. - Update uses update operators,
e.g.
{"$set": {"status": "active"}, "$inc": {"loginCount": 1}}. - Pipeline is an ordered list of aggregation stages,
e.g.
[{"$match": {"active": true}}, {"$group": {"_id": "$country", "total": {"$sum": 1}}}].
New Document trigger
The New Document trigger detects new documents by tracking the highest value seen for the
configured Order By Field. Use a monotonically increasing field such as _id (the default)
or a creation timestamp so that newly inserted documents are reliably detected. The first poll
records the current position and does not emit the existing backlog.
How is this guide?
Last updated on
MongoDB Chat Memory
MongoDB Chat Memory stores conversation history in MongoDB for flexible, document-based persistent storage.
MongoDB Atlas Vector Search
MongoDB Atlas Vector Search combines document storage with vector similarity search, enabling storage and retrieval of high-dimensional embeddings for AI and machine learning applications.