NoSQL Databases
The NoSQL Databases node executes operations against MongoDB databases. It supports standard CRUD operations as well as aggregation queries, giving you full control over document-based data within your automation workflows.
Before You Use This Node
| What you may need | Where to set it up | Why it matters |
|---|---|---|
| MongoDB connection | Connections | Save database access once, then reuse it for every MongoDB action. |
| Common collection names, IDs, or filters | Global Variables | Keep repeated MongoDB values easy to maintain. |
| Reusable reference data | Datasets | Keep lookup data available for document workflows. |
Actions
| Action | Description |
|---|---|
nosql:mongodb | Execute a MongoDB operation on a specified collection |
nosql:mongodb
Performs a MongoDB operation. The specific operation is determined by the operation field in the configuration.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
connectionId | string | Yes | ID of the MongoDB connection |
operation | string | Yes | The operation to perform: find, findOne, insertOne, insertMany, updateOne, updateMany, deleteOne, deleteMany, aggregate, countDocuments |
collection | string | Yes | Name of the MongoDB collection |
query | object | Conditional | Query filter document (required for find, update, delete operations) |
document | object | Conditional | Document to insert (required for insert operations) |
documents | array | Conditional | Array of documents (required for insertMany) |
update | object | Conditional | Update operations document (required for update operations) |
pipeline | array | Conditional | Aggregation pipeline stages (required for aggregate) |
sort | object | No | Sort specification (e.g., {"createdAt": -1}) |
limit | integer | No | Maximum documents to return |
skip | integer | No | Number of documents to skip |
projection | object | No | Fields to include or exclude (e.g., {"name": 1, "_id": 0}) |
Example: Find Documents
Example: Insert One Document
Example: Update Many Documents
Example: Aggregation Pipeline
Example: Delete Documents
Connection Types
The connection string format determines how the driver connects to MongoDB:
- Standard MongoDB:
mongodb://host:27017-- connects to a single MongoDB instance or standalone server. - MongoDB Atlas (cloud):
mongodb+srv://cluster.mongodb.net-- uses DNS seed list discovery for Atlas clusters. - Replica set:
mongodb://host1:27017,host2:27017,host3:27017/?replicaSet=myRS-- connects to a replica set with automatic failover.
Set the appropriate connection string in the url field of the connection configuration.
Bulk Operations
- Use
insertManyfor batch inserts. It is significantly more efficient than callinginsertOnemultiple times because it sends all documents in a single network round-trip. - Use
updateManyto update all documents matching a filter in one operation. - For very large bulk operations (thousands of documents), consider splitting them into smaller batches to avoid step timeout. For example, insert 500 documents per step rather than 10,000 at once.
Common Problems
| Symptom | Likely Cause | Fix |
|---|---|---|
| Connection failed | Incorrect URL, network issue, or IP not whitelisted | Verify the url field. For Atlas, ensure the automation server's IP is in the Atlas IP Access List |
| Authentication failed | Wrong credentials or incorrect authSource | Check username, password, and authSource (defaults to admin) |
| Collection not found | Misspelled collection name or wrong case | MongoDB collection names are case-sensitive. Verify the exact name |
| Query timeout | Missing indexes or large result set | Add indexes on frequently queried fields. Use limit and projection to reduce the response size |
| Document too large | Document exceeds 16 MB | MongoDB enforces a 16 MB document size limit. Split large documents or store large payloads in GridFS |
Connection
Requires a MongoDB connection configured in the Global Configurator:
| Field | Description |
|---|---|
url | MongoDB connection string (e.g., mongodb://host:27017 or mongodb+srv://...) |
database | Database name |
username | Database user (if authentication is enabled) |
password | Database password |
authSource | Authentication database. Defaults to admin |
Configure under Connections > MongoDB in the Global Configurator.