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.

InputDefaultNotesExample
Collection
string
/ Required
collection
The name of your collection.
customers
Cluster Connection String
string
/ Required
connectionString
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
string
/ Required
database
The name of your database.
admin
Use Mongo v4
boolean
useV4
false
Use the older NodeJS v4 driver which is compatible with older MongoDB installations. This component defaults to using the v6 NodeJS driver.
 

Actions

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
string
/ Required
objectId
The ID to convert to an Object ID.
5a9427648b0beebeb69579e7

Delete Many

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

InputNotes
Query Fields
string
Key Value List
document
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
connection
/ Required
mongoConnection
 

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

Find All

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

InputDefaultNotes
Comparison Operator
string
comparisonOperator
The comparison operator to use when filtering documents. Use this field in conjunction with the "Query Fields" input.
Convert Values to Numbers
boolean
convertValuesToNumbers
false
If true, number values detected in the "Query Fields" input will be converted to numeric types.
Limit
string
limit
The maximum number of documents to return.
Connection
connection
/ Required
mongoConnection
 
 
Query Fields
string
Key Value List
queryFilter
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
string
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

InputDefaultNotes
Comparison Operator
string
comparisonOperator
The comparison operator to use when filtering documents. Use this field in conjunction with the "Query Fields" input.
Convert Values to Numbers
boolean
convertValuesToNumbers
false
If true, number values detected in the "Query Fields" input will be converted to numeric types.
Connection
connection
/ Required
mongoConnection
 
 
Query Fields
string
Key Value List
queryFilter
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

InputNotes
Documents
data
/ Required
Value List
documentList
For each item, provide a document ( Javascript Object ) to be inserted into the collection.
Connection
connection
/ Required
mongoConnection
 

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

Insert One

Insert a new document into a collection | key: insertOne

InputNotes
Document Fields
data
/ Required
Key Value List
document
Provide key and value pairs that make up the properties of your document.
Connection
connection
/ Required
mongoConnection
 

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

Raw Request

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

InputDefaultNotesExample
Execute Command
code
/ Required
executeCommand
Provide the command to execute. See https://www.mongodb.com/docs/v6.0/reference/command/ for more information.
Connection
connection
/ Required
mongoConnection
 
 
 
Run Admin Command
boolean
runAdminCommand
false
If true, the command will be executed against the admin database.
 

Update Many

Update multiple documents in a collection | key: updateMany

InputDefaultNotes
Comparison Operator
string
comparisonOperator
The comparison operator to use when filtering documents. Use this field in conjunction with the "Query Fields" input.
Convert Values to Numbers
boolean
convertValuesToNumbers
false
If true, number values detected in the "Query Fields" input will be converted to numeric types.
Update Fields
data
Key Value List
documentUpdate
Provide key and value pairs to be inserted/updated in your document.
Connection
connection
/ Required
mongoConnection
 
 
Query Fields
string
Key Value List
queryFilter
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
boolean
upsert
false
If true, creates a new document when no document matches the query criteria.

Update One

Update a single document in a collection | key: updateOne

InputDefaultNotes
Query Fields
string
Key Value List
document
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
data
Key Value List
documentUpdate
Provide key and value pairs to be inserted/updated in your document.
Connection
connection
/ Required
mongoConnection
 
 
Upsert
boolean
upsert
false
If true, creates a new document when no document matches the query criteria.

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