Skip to content

feat: add support for jsonContains operator on array fields - #856

Open
aaqilniz wants to merge 1 commit into
loopbackio:masterfrom
aaqilniz:feat/support-jsoncontains
Open

aaqilniz wants to merge 1 commit into
loopbackio:masterfrom
aaqilniz:feat/support-jsoncontains

Conversation

@aaqilniz

@aaqilniz aaqilniz commented Nov 1, 2026 •

Copy link
Copy Markdown
Contributor
  • Implements the jsonContains operator mapping inside MySQL.prototype.buildExpression to support containment queries (such as those required for referencesMany relations).
  • Automatically parses and normalizes stringified JSON or single values into an array, generating MySQL-native JSON_CONTAINS(col, CAST(? as JSON)) expressions connected with OR.
  • Adds comprehensive unit and integration tests covering record filtering and raw SQL string/parameter generation.

This PR depends on PR@loopback-next. The find method never resolves the options parameter. This PR adds that.

This PR also depends on loopbackio/loopback-datasource-juggler#2615. The datasource-juggler identifies the inq filter with referencesMany and converts the filter to jsonContains.

Checklist

  • DCO (Developer Certificate of Origin) signed in all commits
  • 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

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