On this page



Queries a collection in MongoDB and outputs an array of documents that match the specified query condition.


In order to use MongoDB service actions, you must have rules set up for each namespace included in the operation.

You can only use the find action in the first stage of a pipeline.

The find action stage has the following syntax:

   "service": "mongodb-atlas",
   "action": "find",
   "args": {
      "database": <dbname>,
      "collection": <collection name>,
      "query": <filter document>,
      "project": <projection document>,
      "limit": <number>

The find action has the following argument:

Argument Type Description
database string Name of the database.
collection string Name of the collection.
query document Query filter to apply for the find operation. Specify the filter as a JSON document. Filter expression can include MongoDB query expressions as well as variables (%%vars) defined in the stage.
project document Optional. Projection document that determines the fields in the output documents.
limit integer Optional. Maximum number of documents to output.


Consider the following pipeline of a single stage:

    "service": "mongodb-atlas",
    "action": "find",
    "args": {"database": "my_db", "collection": "reports", "query": {"views": {"$gt": 75}}, "project": {}, "limit": 5}

Stage1: The MongoDB service find stage runs the query {"views": {"$gt": 75}} against the specified collection my_db.collection and outputs, at most, 5 documents that meet the query filter.

←   delete insert  →