MongoDB Listener Plugin
The MongoDB listener plugin polls for records from a MongoDB collection and publishes them to 1Gateway. It allows you to run MongoDB queries to filter out documents and avoid retrieving duplicate data.
Prerequisites
- Network access to the MongoDB database from which data is retrieved.
Configuration Parameters
| Field name | Supported values | Description | Example |
|---|---|---|---|
| Connection string | Valid connection string | Connection string to the MongoDB database. | mongodb://192.168.0.40:27017/?directConnection=true |
| Database name | Any string | Name of the database to connect to. | test |
| Collection name | Any string | Name of the collection to extract data from. | audit_data |
| Database user | Any string | MongoDB user. Leave blank if authentication is not required. | |
| Database password | Any string | MongoDB user's password. Leave blank if authentication is not required. | |
| Query | Valid MongoDB query | Query to be executed. The $value placeholder will be replaced with the value of a field in the last message from the last poll cycle or with a default value. | { "timestamp": { "$gt": { "$date" : "$value" } }} |
| Field parameter (optional) | Any string | An existing message field name. Its value will replace the $value placeholder in the query. | timestamp/$date |
| Field default value (optional) | Any string | Starting parameter value (must be valid). | 2022-12-15T08:20:16.702+00:00 |
| Projection | Comma-separated list | Determines which fields from the result to select in the output. Leave blank to get all fields. | action,status,objectname,objectid |
| Sort | Comma-separated list | Determines the order of the results in the output. Leave blank for any sorting. | {"timestamp": 1} |
| Message type | Any string | 1Gateway message type of the MongoDB records. | MongoDBMessage |
| Polling interval (in seconds) | Integer | Recommended interval in seconds for polling (e.g., 86400 for once a day). | 86400 |