MongoDB (Input Agent cron)

Note: The document type is automatically set to "JSON" when you use this Input Agent.

Settings


(1) Alias: Alias for the connection to the database. A database alias stands for a configured connection to a database system (see section MongoDBConnectionService). In addition, all variables with prefix MSG_CALL_ defined in the profile are available for selection. This makes it possible to pass the alias from a triggering profile or with an HTTP call. Note: For easy testability, the variables should be defined with a default value.

(2) Database: The database to which the query refers (similar to a schema in an SQL database). Note: Although a database is already specified in the alias using parameter "catalogName", you can overwrite the value for this connection here in the Input Agent.

(3) Collection: The collection to which the query refers (similar to a table in an SQL database).

(4) Output as: A MongoDB stores datasets as BSON documents. BSON is a binary representation of JSON documents but contains more data types than JSON. If you select BSON, BSON-specific data types are displayed in the returned JSON document. See section below. Note: See also the MongoPostexecuter on this topic.

(5) Max allowed documents to read in: If a query returns more than the number of documents specified here, only the specified number of documents is read in (here 20), all others are ignored. If the query returns 22 documents, document 21 and 22 will be ignored. However, this does not generate an error.

(6) Combine all documents to one request: If this checkbox is set, all documents found by the query are combined into a single JSON document and only one job is started. If the checkbox is not set, then each document found by the query is returned individually and a separate job is started for each document.

(7) Query: The query to be executed. The query language is not discussed here, please see the manufacturer's documentation. Queries can be saved and saved queries can be selected via the context menu. They can be managed via a further dialogue. Example: "{}".

Note: Permanent profile values (syntax %perm:KEYNAME%) can be used, but this only works in a profile run and not via (9).

Note: If you specify a query in curly braces (as in the screenshot), the find() method is used. If you specify an array as a query (so in square brackets), the aggregate() method is automatically used instead. Example:

[
{$match: {"FAILED": "false"}},
{$group: {"_id": "$_id", "PID": {"$first": "$PROFILE_ID"}, "TOTAL": {$sum: "$JOB"}}}
]

(8) Projection: This field can be used to execute a query with projection. Example: "{FAILED:1}". This would execute the query "find({},{FAILED:1})".

(9) Test query: Executes the query (7) as a test. Note: Only the first result dataset is displayed in the test.

(10) Create structure: Creates a source structure that fits the query. Attention: An already existing source structure is overwritten!

Output format BSON and JSON


See item (4). The following is an arbitrary example document to illustrate the differences between the two output formats.

JSON


JSON
[{
"_id": "5ea94c0cfcba7e213485e8a4",
"JOB": 0,
"PROFILE": "httpin",
"PROFILE_ID": "6f6fbe3d:171c4d6b593:-7f28.d19731995bc0c589:6f6fbe3d:171c4d6b593:-8000",
"START": "2020-04-29T11:42:36.930Z",
"END": "2020-04-29T11:42:36.944Z",
"FAILED": false,
"FILENAME": "n.a.",
"BACKUP": "Job_0",
"CLIENT": "-1",
"ROLE": "",
"DISPLAY1": "",
"DISPLAY2": "",
"DISPLAY3": "",
"LOGPOOL": "STANDARD"
}]

BSON


BSON
[{
"_id": {
"$oid": "5ea94c0cfcba7e213485e8a4"
},
"JOB": {
"$numberLong": "0"
},
"PROFILE": "httpin",
"PROFILE_ID": "6f6fbe3d:171c4d6b593:-7f28.d19731995bc0c589:6f6fbe3d:171c4d6b593:-8000",
"START": {
"$date": {
"$numberLong": "1588153356930"
}
},
"END": {
"$date": {
"$numberLong": "1588153356944"
}
},
"FAILED": false,
"FILENAME": "n.a.",
"BACKUP": "Job_0",
"CLIENT": "-1",
"ROLE": "",
"DISPLAY1": "",
"DISPLAY2": "",
"DISPLAY3": "",
"LOGPOOL": "STANDARD"
}]