Skip to content

fix: transform inq to jsonContains for referencesMany relation queries - #2615

Open
aaqilniz wants to merge 1 commit into
loopbackio:masterfrom
aaqilniz:fix/inq-in-refmany
Open

aaqilniz wants to merge 1 commit into
loopbackio:masterfrom
aaqilniz:fix/inq-in-refmany

Conversation

@aaqilniz

@aaqilniz aaqilniz commented Oct 31, 2026 •

Copy link
Copy Markdown
Contributor

Fixes query execution for referencesMany relations where standard inq queries fail against array fields stored as JSON.

Changes

  • Updates DataAccessObject.find to inspect model definitions and settings for referencesMany relations.
  • Automatically detects when a where clause queries a referencesMany relation's keyFrom field using an inq operator.
  • Translates { field: { inq: [...] } } into { field: { jsonContains: [...] } }, allowing downstream connectors to construct proper JSON array containment queries (e.g., JSON_CONTAINS).
  • Tests Added: Added unit tests covering query translation, non-inq operator preservation, and edge cases where options/models are omitted.

Checklist

  • Sign off your commits with DCO (Developer Certificate of Origin)
  • npm test passes on your machine
  • New tests added or existing tests modified to cover all changes
  • Code conforms with the style guide
  • Commit messages are following our guidelines

@aaqilniz aaqilniz changed the title fix: handle inq for referencesMany fix: transform inq to jsonContains for referencesMany relation queries Oct 31, 2026
@aaqilniz
aaqilniz marked this pull request as ready for review November 1, 2026 06:05
@aaqilniz
aaqilniz requested a review from dhmlau as a code owner November 1, 2026 06:05
@aaqilniz
aaqilniz force-pushed the fix/inq-in-refmany branch 2 times, most recently from 4a56ff3 to cd07b47 Compare November 1, 2026 06:29
Signed-off-by: Muhammad Aaqil <aaqilcs102@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant