Skip to main content

Module relations

Module relations 

Source
Expand description

Relations: the join tables, and the query constructs that read them.

A Relation field has no column. It is skipped on write, stored as relation<Target> in _SCHEMA, and synthesized from the schema on read. Membership lives in _Join:<key>:<className> as documents of exactly {relatedId, owningId} (DatabaseController.js:319-321, :418-420, :794-830), and those collections have no _SCHEMA row at all. parse_rust_storage::join_schema builds the shape in memory for that reason: writing a schema row for a join table would add a class every parse-server node reading the same database would then see.

The writes here are not atomic with the parent write. The row write, the join upsert and the schema reservation are three operations, and without transactions any of them can fail independently, leaving a membership recorded against a row that was never written or a row written without its membership. Upstream has the same exposure on a non-replica-set deployment. It is stated here rather than left to be discovered.

Structs§

RelationUpdate
One pending membership change, stripped out of a write body.

Enums§

RelatedToOutcome
What a $relatedTo resolved to.
RelationConstraint
Which reverse-join read a constraint on a Relation-typed field asks for.
RelationOpKind

Functions§

add_in_object_ids
Intersect an objectId $in into a query. addInObjectIdsIds (DatabaseController.js:1310-1345).
add_not_in_object_ids
Union an objectId $nin into a query. addNotInObjectIdsIds (DatabaseController.js:1347-1372).
apply_relation_updates
Apply membership changes, after the row write has succeeded.
authorize_related_to
authorizeRelatedToQuery (DatabaseController.js:1260-1308), run before the join table is read.
collect_relation_updates
Strip AddRelation and RemoveRelation out of a write body, including inside a Batch.
owning_ids
The owning objectIds that relate to any of these ids. owningIds (DatabaseController.js:1036-1045).
related_ids
The related objectIds of one owning object. relatedIds (DatabaseController.js:1015-1032).
relation_constraints_for
Read every constraint on one Relation-typed field, as one group.