Skip to main content
Version: 4.51.0

Mongo Query

The Mongo Query component allows you to execute queries on a collection of a MongoDB database.

By default, it will retrieve all the documents. Additionally, you can filter which documents are retrieved based on query and specify a sort order.

Handlebars

This component lets you use Handlebars templates. More information about Handlebars can be found in this section

Configuration

Display Settings

General

Connection string

A MongoDB connection string.

Example: mongodb://<username>:<password>@localhost:27017/<databaseName>

Here <databaseName> is the database to connect to.

Collection Name

The name of the collection to query.

Example: documents

Query

A Mongo query that can be passed in find(). Example: {"kind":"CONTAINER"}

You can use Handlebars to create dynamic queries. For nested keys, you can use the so-called dot-notation.

An empty query value or empty object {} will return all the data from the database.

Sort

Specify in the sort parameter the field or fields to sort by and a value of 1 or -1 to specify an ascending or descending sort respectively.

Example: {"kind":1}

Projection

Specify in the projection parameter the field or fields you want to include or exclude from the query result. A value of 1 indicates inclusion and a value of 0 indicates exclusion.

note
Inclusion and exclusion cannot be used simultaneously.

Example: {"kind":1}

Limit

Specify a limit on the number of documents that you want to retrieve.

Skip

Specify the amount of documents that should be skipped before results are retrieved.

Enable parsing numberDecimal

By default Mongo will retrieve NumberDecimals (in this example 1.05) as { $numberDecimal: "1.05" }. By enabling parsing numberDecimal the returning value will be a float: 1.05 instead.

note
Rounded numbers will parse to a number that does not have its decimals anymore. For example { "testKey": { $numberDecimal: "1.0" } } will parse to { "testKey": 1 }.

TLS

Use TLS

Whether or not to use TLS in case your mongoDB requires TLS.

Allow Invalid Certificates

Checking this will disable certificate validation.

warning
Specifying this option in a production environment makes your application insecure and potentially vulnerable to expired certificates and to foreign processes posing as valid client instances.

Certificate Authority File

One or more certificate authorities to trust when making a TLS connection. In order to access the local filesystem, the XILL4_WORKDIRS environment variable must be set to the path of the directory to be accessed.

Example: .\ca.pem

Rate limit

Batch size

Allows you to configure the batch size.

Interval

The interval in milliseconds in which the requests happen.

Inputs | Outputs


Mongo-Query
Input
Output
Error
0 0 0 (ilygfry455)

The incoming message is not used unless the query uses a variable from this object. The incoming message can be empty if you don't need any variables.

Example:
//query in config:
{ "kind":"{{kind}}" }

//incoming message:
{
_id: "135176441e008d9d0c5ba0cee61783ce",
kind: "CONTAINER"
}