All nodes/Data/Database
DB Find
Searches documents by a MongoDB-style filter with sort/limit/skip/projection. Returns an array of documents.
Type in the graph: db_find
Exec
An error branch can be enabled (expose_error_output) to handle failures on their own path.
Ports can be split into separate execution and data handles.
Try it
Minimal working workflow
- Execute + Data
Runs as pasted
When to use it
Reach for Find when you need a list of documents: tickets in the “new” state, a customer’s recent orders, one page of a catalogue. A single document looked up by key is cheaper and clearer with db_find_one, and when all you need is a number, use db_count — it never carries the documents out. Semantic search over text belongs to rag_query; this node matches exact field values.
How it works
The Filter port carries both the trigger and the filter itself. An object arriving over the edge replaces the filter from the settings; when nothing arrives (a blank string from an execution-only trigger counts as nothing) the configured filter is used. A value of any other shape — a string, a number, a list — fails the node with a clear error instead of turning into “match everything”.
The Filter, Sort and Projection fields are JSON editors, not templates: {{ … }} is not
expanded there and travels into the query as an ordinary string. Build a dynamic filter upstream —
a template emitting a JSON object as a string, or
code_javascript returning an object — and feed it to the port.
The output holds docs (the array of documents) and count. count is the size of the returned
page, not the number of matches in the collection: it is measured after limit and skip.
Common mistakes
- Reading
countas the total. The number of matching documents is a separate db_count run with the same filter. - Forgetting the limit. It defaults to 100, so documents “disappear” at exactly the 101st.
- Paging without a sort.
skipslices an order nobody promised, so pages start to overlap. Always set a sort when you page. - Mixing the projection. Including (
1) and excluding (0) fields in one projection is rejected. With an including projection_idcomes back anyway. - Sending the whole object into a template. Use
{{ nodes.<id>.output.docs }}, otherwise the bookkeepingcounttravels downstream too. - A filter with no plain equality. Conditions such as
$gt,$inand$regexare evaluated over the whole collection, andlimitdoes not shorten that scan. Add at least one exact match on a top-level field.
Inputs
| Port | Wire | Payload | Notes |
|---|---|---|---|
Filterinput | Execute + Dataexecute_data | — | Run trigger and dynamic payload (overrides static config). The payload must be an object — a value of any other shape fails the node instead of being ignored. |
Outputs
| Port | Wire | Payload | Notes |
|---|---|---|---|
Resultoutput | Execute + Dataexecute_data | object |
Configuration
| Field | Type | Default | Description |
|---|---|---|---|
Collectioncollection_id | string | "" | Collection ID |
Filterfilter | object | — | MongoDB-style filter expression. |
Limitlimit | integer | 100 | |
Projectionprojection | object | — | MongoDB-style projection (1 = include, 0 = exclude). |
Skipskip | integer | 0 | |
Sortsort | array<array> | — | List of [field, direction] pairs where direction is 1 (asc) or -1 (desc); "asc" / "desc" are accepted too. A malformed pair fails the node — it is not dropped, so the query never runs silently unsorted. |
Shared fields
Every node has these three — the platform adds them, not the node author.
expose_error_output— When enabled, show an execution output to connect nodes that run if this step fails.split_ports_in— Show separate execution and data input handles instead of one combined port.split_ports_out— Show separate execution and data output handles instead of one combined port.