EN-US
Ask or search…
K
Links
Comment on page

Mongo DB

Discover more about the Mongo DB component and how to use it on the Digibee Integration Platform.
Mongo DB makes operations in a Mongo database connection, returning only one JSON object.
Important: mind the memory consumption for big datasets.

Parameters

Take a look at the configuration parameters of the component. Parameters supported by Double Braces expressions are marked with (DB).
Parameter
Description
Default value
Data type
Account
Account to be used by the component. Supported accounts: Basic and Certificate Chain.
N/A
String
Use SSL/TLS to connect
When activated, a secure SSL/TLS connection will be used.
False
Boolean
Custom SSL/TLS certificate
Sets the custom certificate that can be used in Double Braces expressions for the secure connection.
N/A
String
Allow invalid hostnames
When activated, the option bypasses the validation of hostnames in SSL/TLS certificates.
False
Boolean
Operation
Operation to be executed (Find, Aggregate, Delete One, Delete Many, Insert One, Insert Many, Update One, Update Many, Replace One, List Indexes, Create Index, and Drop Index).
Find
String
Connection String
Connection string.
mongodb://localhost:27017
String
Database Name
Name of the database.
databaseName
String
Collection Name
Name of the collection.
collectionName
String
Expire after seconds
Time (in seconds) for documents expiration when using a TTL index. Only available if the Create Index operation is selected.
0
Integer
Query (DB)
Mongo specification to be used. For example: { _id: ObjectId( {{ message.$.id }} ) }
N/A
String
Document
Available only if Insert One, Insert Many, Update One, Update Many, or Replace One are selected.
N/A
String
Limit (DB)
Specification of the maximum number of objects that can be returned.
0
Integer
Skip (DB)
Number of objects to be skipped before returning to the query.
0
Integer
Sort
Specification of the parameter to be sorted by the field.
N/A
String
Fail On Error
If the option is enabled, the execution of the pipeline with error will be interrupted; otherwise, the pipeline execution proceeds, but the result will show a false value for the “success” property.
False
Boolean
Max Wait For Connection (in ms)
Defaults to 10000 (you may choose your option).
10000
Integer
Connection Timeout (in ms)
30000 (you may choose here).
30000
Integer
Socket Timeout (in ms)
30000, or another value.
300000
Integer
Heartbeat Connection Timeout (in ms)
10000 (you can determine your choice).
10000
Integer
Max Connection Idle Timeout (in ms)
Defaults to 1800000.
1800000
Integer
Currently, the component only supports Basic and Certificate Chain accounts, and it must be informed through the Account field, not directly in the connection string.
You can:
  • use a fixed JSON:
document = "{\"data\": [{\"object\": 1}, {\"object\": 2}]}"
  • get some JSON of the message, that will search the 'data' object of the message:
document = "{{ message.$.data }}
  • combine both examples:
document = "{\"data\": [{\"object\": {{ message.$.id1 }}}, {\"object\": {{ message.$.id2 }}}]}"]
If MongoDB needs some authentication, you must create an account (BASIC type) and use it in the component.
To convert Double Braces, we use JSON Path specifications. Read the documentation about JSON Path on GitHub.

Mongo DB in Action

Operation Find

Config

{
"operation": "FIND",
"databaseName": "test",
"collectionName": "model",
"url": "mongodb://localhost:27017",
"query": "{_id: ObjectId({{ message.$.parameters.id }})}",
"failOnError": false
}

Input

{
"parameters": {
"id": "5c87c7af06c3af7dbedc7bb3"
}
}

Output

{
"data": [...some data...],
"rowCount": 10,
"updateCount": 0
}

Operation Replace One

Config

{
"operation": "REPLACE_ONE",
"databaseName": "test",
"collectionName": "model",
"document": "{\"data\": [{\"object\": 1}, {\"object\": 2}]}",
"url": "mongodb://localhost:27017",
"query": "{_id: ObjectId({{ message.$.parameters.id }})}",
"failOnError": false
}

Input

{
"parameters": {
"id": "5c87c7af06c3af7dbedc7bb3"
}
}

Output

{
"data": {},
"rowCount": 0,
"updateCount": 1
}

Operation Update

Config

{
"operation": "UPDATE",
"databaseName": "test",
"collectionName": "model",
"document": "{\"$set\": {\"data\": [{\"object\": 1}, {\"object\": 2}]}}",
"url": "mongodb://localhost:27017",
"query": "{_id: ObjectId({{ message.$.parameters.id }})}",
"failOnError": false
}

Input

{
"parameters": {
"id": "5c87c7af06c3af7dbedc7bb3"
}
}

Output

{
"data": {},
"rowCount": 0,
"updateCount": 1
}

Operation Update Many

Config

{
"operation": "UPDATE_MANY",
"databaseName": "test",
"collectionName": "model",
"document": "{\"$set\": {\"data\": [{\"object\": 1}, {\"object\": 2}]}}",
"url": "mongodb://localhost:27017",
"query": "{name: ObjectId({{ message.$.parameters.name }})}",
"failOnError": false
}

Input

{
"parameters": {
"name": "NAME"
}
}

Output

{{
"data": {},
"rowCount": 0,
"updateCount": 1
}

Operation Delete

Config

{
"operation": "DELETE",
"databaseName": "test",
"collectionName": "model",
"url": "mongodb://localhost:27017",
"query": "{_id: ObjectId({{ message.$.parameters.id }})}",
"failOnError": false
}

Input

{
"parameters": {
"id": "5c87c7af06c3af7dbedc7bb3"
}
}

Output

{
"data": {},
"rowCount": 10,
"updateCount": 0
}

Operation Delete Many

Config

{
"operation": "DELETE_MANY",
"databaseName": "test",
"collectionName": "model",
"url": "mongodb://localhost:27017",
"query": "{name: {{ message.$.data.name }}}",
"failOnError": false
}

Input

{
"data": {
"name": "NAME"
}
}

Output

{
"data": {},
"rowCount": 10,
"updateCount": 0
}

Operation Insert

Config

{
"operation": "INSERT",
"databaseName": "test",
"collectionName": "model",
"document": "{\"data\": {{ message.$.body }}}",
"url": "mongodb://localhost:27017",
"failOnError": false
}

Input

{
"parameters": {
"id": "5c87c7af06c3af7dbedc7bb3"
},
"body": [
{"a": 1},
{"a": 2}
]
}

Output

{
"data": {},
"rowCount": 0,
"updateCount": 1
}

Operation Insert Many

Config

{
"operation": "INSERT_MANY",
"databaseName": "test",
"collectionName": "model",
"document": "{{ message.$.body }}",
"url": "mongodb://localhost:27017",
"failOnError": false
}

Input

{
"parameters": {
"id": "5c87c7af06c3af7dbedc7bb3"
},
"body": [
{"a": 1},
{"a": 2}
]
}

Output

{
"data": {},
"rowCount": 0,
"updateCount": 1
}

Operation Aggregate

Config

{
"operation": "AGGREGATE",
"databaseName": "test",
"collectionName": "model",
"url": "mongodb://localhost:27017",
"query": "[{\"$match\":{\"zip\":\"90210\"}},{\"$group\":{\"_id\":null,\"count\":{\"$sum\":1}}}]",
"failOnError": false
}

Input

{
"parameters": {
"id": "5c87c7af06c3af7dbedc7bb3"
}
}

Output

{
"data": [...some data...],
"rowCount": 10,
"updateCount": 0
}

Operation List Indexes

Config

{
"operation": "LIST_INDEXES",
"databaseName": "test",
"collectionName": "model",
"url": "mongodb://localhost:27017",
"failOnError": false
}

Input

{ }

Output

{
"data": [...some data...],
"rowCount": 10
}

Operation Create Index

Config

{
"operation": "CREATE_INDEX",
"databaseName": "test",
"collectionName": "model",
"url": "mongodb://localhost:27017",
"expireAfterSeconds": "3600",
"query": "{ \"createdAt\": 1 }",
"failOnError": false
}

Input

{ }

Output

{
"data": "createdAt_1",
"updateCount": 1
}

Operation Drop Index

Config

{
"operation": "DROP_INDEX",
"databaseName": "test",
"collectionName": "model",
"url": "mongodb://localhost:27017",
"query": "{ \"createdAt\": 1 }",
"failOnError": false
}

Input

{ }

Output

{
"data": { },
"updateCount": 1
}
Mongo DB supports static Double Braces in the following parameters that were previously specified:
  • operation
  • url
Last modified 1mo ago