MongoDB

The MongoDB message source type can be used to monitor a MongoDB database collection for new or updated documents. Each document found will then be passed to an Automation for processing. You can connect to a local MongoDB or a cloud based MongoDB compatible document database such as MongoDB Atlas, Amazon DocumentDB or Azure Cosmos DB.

Enter the MongoDB Connection String, Database Name and Collection Name. Enter the Query json and optionally the Projection and Sort json. Click the Test button to test the connection and query.

ThinkAutomation automatically caches the last document _id value between requests in the %LastDatabaseId% variable. This can be used in the Query json. For example:

{ "_id": { "$gt": "%LastDatabaseId%" } }

This Query will retrieve all documents where the _id value is greater than then last requested _id.

Each document returned from the query will be passed to the Automation for processing in its Json format. You can then create Extracted Fields on your Automation to extract each value that you need in your Automation. Extracted Fields have an Extract Json option for easy extraction of Json data.