MongoDB

Use MongoDB to query collections, insert one or more documents, update or delete documents selected by a filter, and run aggregation pipelines. Configure the database connection and collection for the selected operation.

The mongodb_query, mongodb_insert, mongodb_update, mongodb_delete, and mongodb_execute operations return data for later workflow steps. Check the write filter and single/multiple-document option before updating or deleting records.

Use the block

Find, insert, update, delete, and aggregate data.

Actions

MongoDB Query

Execute find operation on MongoDB collection

Input

ParameterTypeRequiredDescription
hoststringYesMongoDB server hostname or IP address
portnumberYesMongoDB server port (default: 27017)
databasestringYesDatabase name to connect to (e.g., "mydb")
usernamestringNoMongoDB username
passwordstringNoMongoDB password
authSourcestringNoAuthentication database
sslstringNoSSL connection mode (disabled, required, preferred)
collectionstringYesCollection name to query
querystringNoMongoDB query filter as JSON string
limitnumberNoMaximum number of documents to return
sortstringNoSort criteria as JSON string

Output

ParameterTypeDescription
messagestringOperation status message
documentsarrayArray of documents returned from the query
documentCountnumberNumber of documents returned

MongoDB Insert

Insert documents into MongoDB collection

Input

ParameterTypeRequiredDescription
hoststringYesMongoDB server hostname or IP address
portnumberYesMongoDB server port (default: 27017)
databasestringYesDatabase name to connect to (e.g., "mydb")
usernamestringNoMongoDB username
passwordstringNoMongoDB password
authSourcestringNoAuthentication database
sslstringNoSSL connection mode (disabled, required, preferred)
collectionstringYesCollection name to insert into
documentsarrayYesArray of documents to insert

Output

ParameterTypeDescription
messagestringOperation status message
documentCountnumberNumber of documents inserted
insertedIdstringID of inserted document (single insert)
insertedIdsarrayArray of inserted document IDs (multiple insert)

MongoDB Update

Update documents in MongoDB collection

Input

ParameterTypeRequiredDescription
hoststringYesMongoDB server hostname or IP address
portnumberYesMongoDB server port (default: 27017)
databasestringYesDatabase name to connect to (e.g., "mydb")
usernamestringNoMongoDB username
passwordstringNoMongoDB password
authSourcestringNoAuthentication database
sslstringNoSSL connection mode (disabled, required, preferred)
collectionstringYesCollection name to update
filterstringYesFilter criteria as JSON string
updatestringYesUpdate operations as JSON string
upsertbooleanNoCreate document if not found
multibooleanNoUpdate multiple documents

Output

ParameterTypeDescription
messagestringOperation status message
matchedCountnumberNumber of documents matched by filter
modifiedCountnumberNumber of documents modified
documentCountnumberTotal number of documents affected
insertedIdstringID of inserted document (if upsert)

MongoDB Delete

Delete documents from MongoDB collection

Input

ParameterTypeRequiredDescription
hoststringYesMongoDB server hostname or IP address
portnumberYesMongoDB server port (default: 27017)
databasestringYesDatabase name to connect to (e.g., "mydb")
usernamestringNoMongoDB username
passwordstringNoMongoDB password
authSourcestringNoAuthentication database
sslstringNoSSL connection mode (disabled, required, preferred)
collectionstringYesCollection name to delete from
filterstringYesFilter criteria as JSON string
multibooleanNoDelete multiple documents

Output

ParameterTypeDescription
messagestringOperation status message
deletedCountnumberNumber of documents deleted
documentCountnumberTotal number of documents affected

MongoDB Execute

Execute MongoDB aggregation pipeline

Input

ParameterTypeRequiredDescription
hoststringYesMongoDB server hostname or IP address
portnumberYesMongoDB server port (default: 27017)
databasestringYesDatabase name to connect to (e.g., "mydb")
usernamestringNoMongoDB username
passwordstringNoMongoDB password
authSourcestringNoAuthentication database
sslstringNoSSL connection mode (disabled, required, preferred)
collectionstringYesCollection name to execute pipeline on
pipelinestringYesAggregation pipeline as JSON string

Output

ParameterTypeDescription
messagestringOperation status message
documentsarrayArray of documents returned from aggregation
documentCountnumberNumber of documents returned

MongoDB Introspect

Introspect MongoDB database to list databases, collections, and indexes

Input

ParameterTypeRequiredDescription
hoststringYesMongoDB server hostname or IP address
portnumberYesMongoDB server port (default: 27017)
databasestringNoDatabase name to introspect (e.g., "mydb"). If not provided, lists all databases
usernamestringNoMongoDB username
passwordstringNoMongoDB password
authSourcestringNoAuthentication database
sslstringNoSSL connection mode (disabled, required, preferred)

Output

ParameterTypeDescription
messagestringOperation status message
databasesarrayArray of database names
collectionsarrayArray of collection info with name, type, document count, and indexes