# Reading records in

The stages that bring records into a pipeline, and the shape that chooses fields.

Four ways to start a pipeline: a collection by name, a bare collection name with filters, a `match` across relations, or a shape that reads one or more collections and keeps chosen fields.

## A collection by name

- `collection`: Read records from the named collection, including names that cannot be written bare. Arguments: name: a nonempty collection name in double quotes.
- `match`: Match a labelled collection or a fixed chain of directed relations first or immediately after its collection. Arguments: nodes: (binding:collection) or up to eight labelled nodes joined by directed relations; binding: distinct names matching [a-z_][a-z0-9_]*; relation: -[:kind]-> or <-[:kind]- at each of up to seven hops.


## A bare name with filters

A collection whose name is lowercase letters, digits and underscores can be written bare. In parentheses, `field: value` pairs keep only matching records. Join several with `and`.

Each named collection must exist at the selected version. The patients collection comes from the first-records guide; wards and nurses are created in [Relations and the graph](/haematite/concepts/relations-and-the-graph/). A notes example needs a notes collection of its own.

```text
patients(ward: "4B")
patients(ward: "4B" and admitted: 20260912)
```


## The shape

- `{ }`: Keep selected fields in record order; a first-stage shape reads collections in root order before worker Input. Arguments: fields: bare names with nested selection sets; source: one or several collection roots in a first-stage shape.


> Field names are bare
> Inside a shape, fields are bare names. A field that is not a bare name is reached in a quoted jq stage instead.


## What comes next

A source may be followed by any [searching](/haematite/query-language/search/) or [finishing](/haematite/query-language/bounds/) stage, or by a quoted jq stage.
