Here are the details of the action function of MongoDB component.
Calculates aggregate values for the data in a collection or a view
groupInfo to the message (outside the body) which allows the message to be rebuilt.pipeline - a sequence of data aggregation operations or stages. See the
aggregation pipeline operators for details. Required field.
Note: Must be an array of pipeline stages.
batchSize - size of pages. Rendered only if Emit Batch strategy is chosen. Default: 10.
{
"pipeline": [
{ $group: { _id: null, count: { $sum: 1 } } }
]
}
{
"pipeline": [
{ $match: { value: 64 } },
{ $addFields: { newField: 88 } },
]
}
{
"pipeline": [
{ $match: { value: 64 } },
{ $addFields: { newField: 88 } },
],
"batchSize": 10
}
Bulk Write takes an array of write operations and executes each of them. Operations executed in provided order.
operations - Valid operations are: insertOne, updateOne, updateMany, deleteOne, deleteMany, replaceOne
{
"operations": [
{
"insertOne": {
"document": {
"test": 1
}
}
},
{
"updateOne": {
"filter": {
"test": "test"
},
"update": {
"test": 2
}
}
}
]
}
Delete document by ID.
‘id’ of the document to delete
{
"id" : "5e936f7c7c876ec2e1e48f4d"
}
{
"result": {
"result": {
"n": 1,
"opTime": {
"ts": "6815603303313833985",
"t": 24
},
"electionId": "7fffffff0000000000000018",
"ok": 1,
"$clusterTime": {
"clusterTime": "6815603303313833985",
"signature": {
"hash": "8NaPN38tce9du4OTS1aMF9qZeoI=",
"keyId": "6781502667437899778"
}
},
"operationTime": "6815603303313833985"
},
"connection": {
"_events": {},
"_eventsCount": 4,
"id": 1,
"address": "35.195.12.99:27017",
"bson": {},
"socketTimeout": 360000,
"monitorCommands": false,
"closed": false,
"destroyed": false,
"lastIsMasterMS": 10
},
"deletedCount": 1,
"n": 1,
"opTime": {
"ts": "6815603303313833985",
"t": 24
},
"electionId": "7fffffff0000000000000018",
"ok": 1,
"$clusterTime": {
"clusterTime": "6815603303313833985",
"signature": {
"hash": "8NaPN38tce9du4OTS1aMF9qZeoI=",
"keyId": "6781502667437899778"
}
},
"operationTime": "6815603303313833985"
}
}
Delete document by Unique Criteria.
criteria of the document to search
{
"criteria": {
"foo" : "bar"
}
}
{
"result": {
"result": {
"n": 2,
"opTime": {
"ts": "6815625881956909058",
"t": 24
},
"electionId": "7fffffff0000000000000018",
"ok": 1,
"$clusterTime": {
"clusterTime": "6815625881956909058",
"signature": {
"hash": "PfOoj8NNKraOSMQIqufBVgFis9g=",
"keyId": "6781502667437899778"
}
},
"operationTime": "6815625881956909058"
},
"connection": {
"_events": {},
"_eventsCount": 4,
"id": 1,
"address": "35.195.12.99:27017",
"bson": {},
"socketTimeout": 360000,
"monitorCommands": false,
"closed": false,
"destroyed": false,
"lastIsMasterMS": 10
},
"deletedCount": 2,
"n": 2,
"opTime": {
"ts": "6815625881956909058",
"t": 24
},
"electionId": "7fffffff0000000000000018",
"ok": 1,
"$clusterTime": {
"clusterTime": "6815625881956909058",
"signature": {
"hash": "PfOoj8NNKraOSMQIqufBVgFis9g=",
"keyId": "6781502667437899778"
}
},
"operationTime": "6815625881956909058"
}
}
Lookup document by ID.
id of the document
{
"id" : "5e936f7c7c876ec2e1e48f4d"
}
{
"result": {
"_id": "5a97f9c91c807bb9c6eb5fb4",
"user_id": "t3qulfeem@kwiv5.6ur",
"name": "John Smith"
}
}
Lookup (at most 1) Document By Unique Criteria.
Action logic:
This document is emitted
‘criteria’ of the document to search. If you provide ObjectId it will be automatically parsed to MongoDB ObjectId
{
"criteria": {
"value" : 4
}
}
{
"criteria": {
"_id" : "ObjectId('64a296786751183ae1f615ed')"
}
}
{
"_id": "5a97f9c91c807bb9c6eb5fb4",
"user_id": "t3qulfeem@kwiv5.6ur",
"name": "John Smith",
"value": 4
}
Lookup many documents by criteria.
groupInfo to the message (outside the body) which allows the message to be rebuilt.‘criteria’ of the document to search. Required field. If you provide ObjectId it will be automatically parsed to MongoDB ObjectId
Please Note:: it is possible to lookup objects by fields with type ObjectID. For enabling this feature use template
"ObjectId('objectId')".

{
"criteria": {
"taskId": "ObjectId('61523b6043a05f0006fc4800')"
},
"limit": 100
}
Known limitation: it is possible to lookup by ObjectId only on first level of criteria object. Nested properties are not supported. In case usage template
"ObjectId('objectId')"on next levels of criteria object value will accept as string.
limit - specifies the maximum number of documents the action will return. 0 is equivalent to setting no limit. Optional field.
project - specifies which fields, including embedded objects, the action should return. Please refer Project Fields to Return from Query for the details. Optional field.
batchSize - size of pages. Rendered only if Emit Batch strategy is chosen. Default: 10.
This will find all the documents (plural) according to th given criteria. In this case this will retrieve all the objects with the root value equals 4:
{
"criteria": {
"value": 4
},
"limit": 100
}
Will return an array of documents inside the result property:
{
"result": [
{
"_id": "5e936f7c7c876ec2e1e48f4d",
"name": "Example4",
"nestedObj": {
"otherValue": 4
},
"value": 4
}
]
}
otherValue equals 4 inside of a property nestedObj.
You will get a ‘Projection cannot have a mix of inclusion and exclusion’ error otherwise.{
"criteria": {
"nestedObj.otherValue": 4
}
}
{
"criteria": {},
"project": { 'fieldFoo': 1, 'fieldBar': 1, '_id': 0}
}
{
"criteria": {
"value": 4
},
"limit": 100,
"batchSize": 10
}
Upserts document by ID.
Document to be upserted.
{
"name" : "some_value",
"surname": "updated_value"
}
{
"result": {
"id": "some id" // object id
// other document properties
}
}
Updates documents in a collection
criteria - the criteria used to select the documents to update. If you provide ObjectId it will be automatically parsed to MongoDB ObjectIdupdate - the update operations to be applied to the documentsPlease refer the MongoDB Update Operators Documentation for the details on the operators.
{
"criteria": {
"nestedObj.otherValue": {
"$gt": 2
}
},
"update": {
"$set": {
"nestedObj.anotherValue":"bla"
}
}
}
{
"criteria": {
"_id" : "ObjectId('64a296786751183ae1f615ed')"
},
"update": {
"$set": {
"nestedObj.anotherValue":"bla"
}
}
}
{
"result": {
"result": {
"n": 2,
"nModified": 2,
"opTime": {
"ts": "6816718766450147330",
"t": 24
},
"electionId": "7fffffff0000000000000018",
"ok": 1,
"$clusterTime": {
"clusterTime": "6816718766450147330",
"signature": {
"hash": "5wbixQ6vmIt6IJehzdL55zp1zYw=",
"keyId": "6781502667437899778"
}
},
"operationTime": "6816718766450147330"
},
"connection": {
"_events": {},
"_eventsCount": 4,
"id": 1,
"address": "35.195.12.99:27017",
"bson": {},
"socketTimeout": 360000,
"monitorCommands": false,
"closed": false,
"destroyed": false,
"lastIsMasterMS": 10
},
"modifiedCount": 2,
"upsertedId": null,
"upsertedCount": 0,
"matchedCount": 2,
"n": 2,
"nModified": 2,
"opTime": {
"ts": "6816718766450147330",
"t": 24
},
"electionId": "7fffffff0000000000000018",
"ok": 1,
"$clusterTime": {
"clusterTime": "6816718766450147330",
"signature": {
"hash": "5wbixQ6vmIt6IJehzdL55zp1zYw=",
"keyId": "6781502667437899778"
}
},
"operationTime": "6816718766450147330"
}
}
Upserts document by unique criteria.
criteria - criteria for upsertion. If you provide ObjectId it will be automatically parsed to MongoDB ObjectId{
"address": "Park Lane 38"
} // Property address equals 'Park Lane 38' in upserted Document
{
"status": {
"$in": "['A', 'D']"
}
} // Property status equals 'A' or 'D'
{
"_id" : "ObjectId('64a296786751183ae1f615ed')"
} // Document MongoDB id equal '64a296786751183ae1f615ed'
value - Document to be upserted.{
"name" : "some_value",
"surname": "updated_value"
}
{
"result": {
"id": "some id" // object id
// other document properties
}
}