Skip to content

Toro Cloud Dev Center


MongoDB listener endpoint

The MongoDB listener endpoint enables you to invoke code when a MongoDB database is changed. It is useful for creating integrations that require persistence and real-time data.

Properties

General configuration

Property Default Description
Name (required) The name of the endpoint.
Service (required) The service to execute when the endpoint is triggered.
Run As Anonymous The user to run the service in behalf of. This is logged to Tracker.
Document Type <Name of endpoint type> The document type to be used when adding documents to Tracker as this endpoint is triggered.
Auto Start true Whether or not to automatically start the endpoint upon package startup.
Log To Tracker false Flag determining whether executions should be logged to Tracker.
Replicated true If this endpoint is configured on a Martini instance that's running in a cluster, replicated will determine whether to run the endpoint on all instances, or only the elected leader node in the cluster. When this is checked, all instances will run the endpoint. When it's unchecked, only the leader node will run the endpoint.

MongoDB listener-specific configuration

Name Default Description
Connection Name (required) Name of the MongoDB database connection.
Database Name (required) Name of the MongoDB database to watch for changes.
Collection Name <none\> Name of the database collection to watch for changes. If no value is specified or this field's value is <none\>, all non-system collections are watched.
Full Document Lookup Default Determines the data to return for update operations.
Keep Alive true Whether the endpoint should be stopped or not when invalidation event occurs (e.g. watched database or collection is dropped).
Pipelines The aggregation pipeline to apply to the listener's change stream. Each pipeline should follow the MongoDB extended JSON format.

Service

When the endpoint is triggered, the following variables are exposed to the configured service:

General parameters

Name Type Description
$trackerId java.lang.String The Tracker document internal ID. If the endpoint was configured to not track, this value will be null.
$tracker io.toro.martini.tracker.Tracker The Tracker object. If the endpoint was configured to not track, this value will be null.
martiniPackage MartiniPackage The Martini package that contains the endpoint.
parameters java.util.Map A map containing all the endpoint specific parameters.
properties java.util.Map A map containing containing all the properties associated with the endpoint.

MongoDB listener-specific parameters

Name Type Description
body io.toro.gloop.object.property.GloopModel Type of the change.
databaseName java.lang.String Name of the database in which the change has occurred.
collectionName java.lang.String Name of the collection in which the change has occurred.
namespace java.lang.String Database name and collection name joined by '.'.
namespaceDocument org.bson.BsonDocument Document type of the namespace.
operationType java.lang.String Type of change. Possible values are: insert, update, replace, delete, invalidate, drop, dropDatabase, rename, other.
fullDocument io.toro.gloop.object.property.GloopModel The complete changed document.
documentKey org.bson.BsonDocument ID of the changed document.
clusterTime java.lang.Long Time at which the change has occurred.
updateDescription com.mongodb.client.model.changestream.UpdateDescription Contains updated/removed fields.