Skip to main content
Roberty Studio
RPAMongoDB

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​

Select a 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" }.

Select a transaction​

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 Select a collection and Filter fields are required.
  • The filter must be a valid JSON document in MongoDB format.
  • If no document is found, document is null and found returns false.