Skip to main content
Version: 1.0.0

Strict mode

Normal projections keep a row even when one of its fields is missing. Add strict when every selected field is required:

Existing null is still present

Strict mode distinguishes a missing field from a field whose value is explicitly null. Only a missing field removes the row.

select strict {id, email} from 'customers.json'

Given:

[
{"id": 1, "email": "amina@example.com"},
{"id": 2}
]

the result is:

[
{"id": 1, "email": "amina@example.com"}
]

The second row is not included because email is missing.

Null and missing fields

An explicit null counts as an existing field for strict selection, although null-valued properties are not written to the projected object. A missing field removes the row.

strict also works with summary selections. Rows missing a field used by the selected functions are removed before aggregation.

Empty objects

Use an empty strict projection to return one empty object for every source row:

select strict {} from 'customers.json'

An empty nested projection does not need strict mode. For example, select {metadata: {}} from 'customers.json' returns {"metadata": {}} for every row.