Skip to main content

Module query

Module query 

Source
Expand description

The query AST adapters lower, and the update AST they apply.

Not a Mongo query document. A Mongo query document is already lowered, and handing one to the Postgres adapter would mean writing a Mongo-query interpreter in SQL, which is roughly the shape upstream ended up with.

Anything outside the supported vocabulary is an error, never silently ignored, because a dropped constraint broadens the result set, which is an authorization failure rather than a missing feature. That rule is enforced at parse time by Comparison::from_operator returning an error for an unknown operator, so there is no code path where an unrecognised constraint reaches an adapter.

0.2.0 turned the flat constraint list into a tree. That was not a generalization for its own sake: pointer permissions compose disjunctively across fields (DatabaseController.js:1815), so a class permitting {find: {pointerFields: ['owner', 'editor']}} cannot be expressed without $or. A flat list would have forced either a wrong conjunction, which under-returns, or no constraint at all, which is the breach.

Structs§

Constraint
One field, one comparison.
Query
A conjunction of clauses. An empty query matches everything.
QueryOptions
Everything about a read that is not a constraint.

Enums§

Clause
One element of a query. Elements of a Query are conjoined.
Comparison
How one field is compared to one value.
SortDirection
Sort direction for one key. Parse spells descending with a leading -.
UpdateValue
What one field of an update does.

Constants§

DEFAULT_LIMIT
Parse’s default page size when a query does not ask for one.

Type Aliases§

Update
An update: ordered, because the compiled document is snapshot-compared.