Skip to main content

MongoDB Component

Interact with documents in a MongoDB database

Component key: mongo

Description

MongoDB is a NoSQL database program that uses JSON-like documents with optional schemas. This component allows you to create, read, update, and delete documents inside a MongoDB collection.

Connections

Mongo Connection

Create a new MongoDB connection and enter the connection string for your MongoDB server.

InputNotesExample
Collection

The name of your collection.

customers
Cluster Connection String

The connection string to use for connecting to a Mongo cluster. From the "Database Deployments" screen, click "Connect" next to a cluster to view the connection string. Refer to https://www.mongodb.com/docs/manual/reference/connection-string/ for details on format and configuration options.

mongodb+srv://<user>:<password>@cluster0.example.mongodb.net/?retryWrites=true&w=majority&appName=Cluster0
Database

The name of your database.

admin
Use Mongo v4

Use the older NodeJS v4 driver which is compatible with older MongoDB installations. This component defaults to using the v6 NodeJS driver.

false

Actions

Aggregate

Performs an aggregation operation using the provided aggregation pipeline. | key: aggregate

InputNotesExample
Aggregation Options

Provide key and value pairs to configure the aggregation operation.

Connection
Aggregation Pipeline

An array of aggregation pipeline stages that process documents in the collection.


Convert Object ID

The Object ID is a unique identifier for a document in a MongoDB collection. This action takes either a string ID or Object ID object, and returns both the ObjectID '_id' and stringified ID versions of the ID which can be used in subsequent actions. | key: convertObjectId

InputNotesExample
Object ID

The ID to convert to an Object ID.

5a9427648b0beebeb69579e7

Delete Many

Remove documents from a collection that match a query. | key: deleteMany

InputNotesExample
Query Fields

Filters are used to narrow down the results of a query, or to determine which documents to update or delete. For example, you can search for documents whose key "firstName" is "John". To search by ID, provide a key of "_id". Use the "Comparison Operator" input to specify the type of comparison to perform if needed.

Connection

{
"data": {
"acknowledged": true,
"deletedCount": 1
}
}

Find All

Retrieve all documents in a collection that match a query. | key: findAll

InputNotesExample
Comparison Operator

The comparison operator to use when filtering documents. Use this field in conjunction with the "Query Fields" input.

Convert Values to Numbers

If true, number values detected in the "Query Fields" input will be converted to numeric types.

false
Limit

The maximum number of documents to return.

Connection
Query Fields

Filters are used to narrow down the results of a query, or to determine which documents to update or delete. For example, you can search for documents whose key "firstName" is "John". To search by ID, provide a key of "_id". Use the "Comparison Operator" input to specify the type of comparison to perform if needed.

Skip

The number of documents to skip when paginating.

{
"data": [
{
"_id": "610ae111774d8aaef3b5d2eb",
"id": "610ae111774d8aaef3b5d2eb",
"exampleKey": "exampleValue"
}
]
}

Find One

Retrieve one document in a collection that match a query. If no document is found, an error is thrown. | key: findOne

InputNotesExample
Comparison Operator

The comparison operator to use when filtering documents. Use this field in conjunction with the "Query Fields" input.

Convert Values to Numbers

If true, number values detected in the "Query Fields" input will be converted to numeric types.

false
Connection
Query Fields

Filters are used to narrow down the results of a query, or to determine which documents to update or delete. For example, you can search for documents whose key "firstName" is "John". To search by ID, provide a key of "_id". Use the "Comparison Operator" input to specify the type of comparison to perform if needed.

{
"data": {
"_id": "610ae111774d8aaef3b5d2eb",
"id": "610ae111774d8aaef3b5d2eb",
"exampleKey": "exampleValue"
}
}

Insert Many

Insert new documents into a collection | key: insertMany

InputNotesExample
Documents

For each item, provide a document ( Javascript Object ) to be inserted into the collection.

Connection

{
"data": {
"acknowledged": true,
"insertedCount": 3,
"insertedIds": {}
}
}

Insert One

Insert a new document into a collection | key: insertOne

InputNotesExample
Document Fields

Provide key and value pairs that make up the properties of your document.

Connection

{
"data": {
"acknowledged": true,
"insertedId": "610ae111774d8aaef3b5d2eb"
}
}

Raw Request

Execute database commands directly. Does not use collection from connection. | key: rawRequest

InputNotesExample
Execute Command

Provide the command to execute. See https://www.mongodb.com/docs/v6.0/reference/command/ for more information.

Connection
Run Admin Command

If true, the command will be executed against the admin database.

false

Update Many

Update multiple documents in a collection | key: updateMany

InputNotesExample
Comparison Operator

The comparison operator to use when filtering documents. Use this field in conjunction with the "Query Fields" input.

Convert Values to Numbers

If true, number values detected in the "Query Fields" input will be converted to numeric types.

false
Update Fields

Provide key and value pairs to be inserted/updated in your document.

Connection
Query Fields

Filters are used to narrow down the results of a query, or to determine which documents to update or delete. For example, you can search for documents whose key "firstName" is "John". To search by ID, provide a key of "_id". Use the "Comparison Operator" input to specify the type of comparison to perform if needed.

Upsert

If true, creates a new document when no document matches the query criteria.

false

Update One

Update a single document in a collection | key: updateOne

InputNotesExample
Query Fields

Filters are used to narrow down the results of a query, or to determine which documents to update or delete. For example, you can search for documents whose key "firstName" is "John". To search by ID, provide a key of "_id". Use the "Comparison Operator" input to specify the type of comparison to perform if needed.

Update Fields

Provide key and value pairs to be inserted/updated in your document.

Connection
Upsert

If true, creates a new document when no document matches the query criteria.

false

{
"data": {
"acknowledged": true,
"modifiedCount": 1,
"upsertedId": null,
"upsertedCount": 0,
"matchedCount": 1
}
}