Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

mongo_read

The raw escape hatch for MongoDB reads: runs a find() with a hand-written Mongo filter document and writes the matched documents as a JSON array. For backend-portable queries, prefer data_query.

Synopsis

{
  "name": "mongo_read",
  "input": {
    "connector": "mongo",
    "database": "shop",
    "collection": "customers",
    "filter": {
      "tier": "vip",
      "since": {
        "$gte": {
          "$date": "2024-01-01T00:00:00Z"
        }
      }
    },
    "projection": {},
    "sort": {
      "since": -1
    },
    "limit": 50,
    "skip": 0,
    "output": "data.vips"
  }
}

Description

mongo_read is a connector function. It names a connector for its credentials and endpoint. Orion validates its input when the workflow is saved, and the call runs through the connector’s circuit breaker.

Retry safety: read. See Retry safety for what the answer costs.

Documents are extended JSON. BSON types with an extended-JSON spelling become real BSON values in the filter. {"$oid": "…"} is an ObjectId, {"$date": "…"} a typed date, and the rest of the family follows. They come back in their canonical spellings in the output, so a value read from one document can drive the next task’s filter unchanged.

Fields

FieldTypeRequiredDefaultDescription
connectorstringyesName of the MongoDB connector
databasestringyesDatabase name
collectionstringyesCollection name
filterobjectno{}MongoDB find filter document (extended JSON)
projectionobjectnoall fieldsMongoDB projection document, for example {"name": 1, "_id": 0}
sortobjectnonatural orderMongoDB sort document, for example {"created_at": -1}
limitnumbernounlimited*Maximum documents to return; must not exceed query.max_limit
skipnumberno0Documents to skip; must not exceed query.max_skip
outputstring | JSONLogicno"data"Dotted path where matched documents are written

* an unlimited read is still bounded: a result larger than query.max_limit is an error rather than an OOM.

Examples

{
  "name": "mongo_read",
  "input": {
    "connector": "mongo",
    "database": "shop",
    "collection": "customers",
    "filter": { "tier": "vip", "since": { "$gte": { "$date": "2024-01-01T00:00:00Z" } } },
    "sort": { "since": -1 },
    "limit": 50,
    "output": "data.vips"
  }
}

Last verified 14 September 2026