MongoDB - Find one document
MongoDB - Find one document
Finds a single document in a MongoDB collection by applying a search filter. Returns the first document that matches the given filter.
Options
Collection
Reference to the MongoDB: Select collection action the search will run on.
Filter (query)
Search filter in MongoDB document format, for example { "email": "usuario@empresa.com" }.
Transaction (optional)
Reference to a MongoDB: Start transaction action when the operation must run inside a transaction. Optional field, available under the advanced options.
Returns
Javascript code
js
actions["action-id"].document // document found (Any)
actions["action-id"].found // true if the document was found, false otherwise (Yes/No)
Field selection
- document — document found (Any)
- found — true if the document was found, false otherwise (Yes/No)
Rules and Conditions
- The Collection and Filter fields are required.
- The filter must be a valid JSON document in MongoDB format.
- If no document is found,
documentis null andfoundreturnsfalse.