Input node
MongoDB input
Read documents from a MongoDB collection into rows.
What it does
Reads documents from a MongoDB collection through a saved Connection and turns them into rows. Pick a database and collection with the live browser, and optionally narrow the read with a JSON find filter or a projection. Top-level fields become columns, with their types worked out by sampling documents; nested objects and arrays arrive as JSON text.
Inputs and outputs
| Inputs | None. This node starts a pipeline. |
| Outputs | One. |
When to use it
- Extract operational data from MongoDB into a warehouse or a file
- Pull a filtered slice of a large collection into a pipeline
- Flatten application documents into something a spreadsheet or BI tool can read
Examples
Pick a collection
sales.orders
The browser lists the real databases and collections the connection can see.
Filter (JSON)
{ "status": "paid", "total": { "$gt": 100 } }A Mongo find filter. Leave it blank to read every document.
Projection (JSON)
{ "_id": 0, "customer": 1, "total": 1 }Reads only these fields, which is much cheaper on a wide document.
A field that appears rarely
Sample size: 5000
More documents sampled means more chance an occasional field becomes a column.
Tips
- MongoDB has no fixed schema, so the columns are inferred from the first documents sampled (Sample size, 100 by default). A field missing from a document is null.
- A field that appears in NO sampled document doesn't become a column at all. Raise Sample size if you know a field is rare but important.
- Its columns show in the builder without a run, read from the same sample of documents.
- Nested objects and arrays come across as JSON strings. Pull values out of them downstream with the JSON parse node.
- Decimal128 values arrive as exact text, the same way the SQL sources hand over a decimal.
- The filter and projection are Mongo's own JSON syntax, not a Trinium row expression.
- A bare collection name uses the connection's default database; write database.collection to be explicit.