Support for subqueries #93

Open
opened 2026-10-25 09:02:39 +01:00 by c.fahner · 2 comments
Owner

Currently it is not possible to query a collection based on the properties of a referenced object. For example, a User entity might have an Address $address property that references a object from the addresses collection. Finding all users that live in a certain city would require querying the path addresses.city, which should not be confused with a query to a JSON column containing an addresses.city path.

To solve this issue, two things must change:

  • It should be possible to distinguish nested paths from field paths
  • There should be some mechanism for predicates to resolve the collection names of referenced objects

One possibility is to introduce a ValuePath object to replace FieldPath's. This ValuePath then has two properties: non-empty-list<non-empty-string> $fieldPath and list<string> $innerPath. The $fieldPath traverses objects/entities and their references, where the last part selects the field on the final object. The (optional) $innerPath can then traverse into the object to retrieve values from nested values, such as JSON fields.

Currently it is not possible to query a collection based on the properties of a referenced object. For example, a `User` entity might have an `Address $address` property that references a object from the `addresses` collection. Finding all users that live in a certain city would require querying the path `addresses.city`, which should not be confused with a query to a JSON column containing an `addresses.city` path. To solve this issue, two things must change: * It should be possible to distinguish nested paths from field paths * There should be some mechanism for predicates to resolve the collection names of referenced objects One possibility is to introduce a `ValuePath` object to replace `FieldPath`'s. This `ValuePath` then has two properties: `non-empty-list<non-empty-string> $fieldPath` and `list<string> $innerPath`. The `$fieldPath` traverses objects/entities and their references, where the last part selects the field on the final object. The (optional) `$innerPath` can then traverse into the object to retrieve values from nested values, such as JSON fields.
c.fahner added this to the v0.3 milestone 2026-10-25 09:02:39 +01:00
c.fahner removed this from the v0.3 milestone 2026-10-25 09:03:04 +01:00
Author
Owner

Possibly related to #33.

Possibly related to #33.
c.fahner added this to the v0.3 milestone 2026-10-26 18:31:47 +01:00
Author
Owner

Re-added v0.3 milestone because the distinction between FieldPath and NestedPath should be made as soon as possible. FieldPath is already quite commonly used.

Re-added v0.3 milestone because the distinction between `FieldPath` and `NestedPath` should be made as soon as possible. `FieldPath` is already quite commonly used.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
slendium/ocd#93
No description provided.