Skip to main content
Version: 4.45.0

Document Count

The Document Count component allows you to count the number of documents in the Content Store.

The count is executed on the ‘documents’ collection.

By default it will count all the documents (when the query is empty) additionally, you can filter which documents are counted based on a query in the config.

Handlebars

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

Configuration

Connection string

A MongoDB connection string.

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

Here <databaseName> is the database to store content.

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

Query

A valid 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.

Inputs

Input The incoming message isn't 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"
}

Outputs

Output

The incoming message as value and the result with the count of documents that match the query in configuration.

Example:

{
value: {
// the incoming message, if there isn't any this is an empty object.
},
result : {
// the resulting count, will be all docs in db when query isn't specified.
}
}

Example with actual result based on the input above:

//If there are 10 documents that have kind: "CONTAINER" in db:
{
value: {
_id: "135176441e008d9d0c5ba0cee61783ce",
kind: "CONTAINER"
},
result: 10
}