Order and bound
limit bound Stop the upstream after at most n records or values at this point in the pipeline.
-
na whole number from 1 to 4294967295
collection("patients") | sort(.admitted; desc) | limit(2) sort order Order the whole upstream by a field before the quoted jq stage.
-
fielda top-level field with a leading dot -
directionoptional desc after a semicolon
collection("patients") | sort(.admitted; desc) desc order Order the sort field from greatest to least instead of ascending order.
window bound Keep records by their revision append version, never by a time inside the record.
-
froman included unsigned version or quoted RFC 3339 instant -
toan excluded bound of the same form, or $now
collection("patients") | window("1970-01-01T00:00:00Z"; $now)
collection("patients") | window(120; 240) One answer
count count Consume the whole upstream and answer its size as the last stage.
patients(ward: "4B") | count group_by group Drain records before jq into key, count and values groups in jq value order; missing fields group under null and no continuation is available.
-
fielda top-level field with a leading dot
collection("patients") | group_by(.ward) percentile aggregate Drain records before jq into one nearest-rank JSON number; empty numeric input gives null, zero selects the minimum, non-numbers are counted as skipped, and no continuation is available.
-
fielda top-level numeric field with a leading dot -
percentilea number from 0 to 100 inclusive
collection("patients") | percentile(.admitted; 95)