Automation Action: Lookup From A MongoDB Database
Lookup a document from a MongoDB database and assign it to a Variable.
Read a document from a MongoDB Collection and assign the Json to a variable. This action can lookup data from any local MongoDB, or cloud based MongoDB compatible document databases including Amazon DocumentDB, Azure Cosmos and MongoDB Atlas.
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.
You can use %variable% replacements in the query. For example:
{ "_id": { "$eq": "%OrderNumber%" } }
See: Query Documents — MongoDB Manual for query syntax.
Select the variable to assign the returned document(s) to from the Assign To list.
The Json can be returned as either:
- MongoDB Relaxed Extended - returns Json as stored in MongoDB. This will include additional objects for date, long, objectid etc.
- Standard - returns standard Json.
Select from the Json Output Mode list.
You can then use Extract Field Actions (with the extract Json path option) to extract individual fields from the document.