You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix(objectql): honor expand where filter on lookup/master_detail expansion
The expand post-processor batch-loads related records with an `$in` query but
never merged the nested QueryAST `where`, so a documented
`expand: { rel: { where: {...} } }` filter was silently ignored — every related
record came back regardless of the filter. The spec schema and
query-syntax.mdx both advertise the nested `where`.
Merge the nested filter via an explicit `$and` group
(`{ $and: [{ id: { $in } }, nestedAST.where] }`) rather than a shallow spread:
a spread would clobber the `id` constraint when the nested filter also keys
`id`, and is ambiguous for a top-level `$or`/`$and`. The `$and` wrapper is
correct for every FilterCondition shape and is executed by the memory matcher
and the SQL/mongo filter compilers.
`limit`/`offset` are intentionally still NOT propagated: this path batch-loads
every parent's related records in one `$in` query, so a per-parent limit can't
be expressed — forwarding it would globally cap the batch and drop records
other parents need. `orderBy` is likewise not observable here (records are
re-keyed by FK on injection). Docs + schema describe updated to match, with a
guard test asserting limit/offset are not pushed into the expand query.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
0 commit comments