Skip to content

feat: $contains_any and $contains_none operators for array-inclusion filtering #228

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

nazarpechka
Copy link

@nazarpechka nazarpechka commented Jun 30, 2025

This PR introduces two new operators for filtering on array-typed PostgreSQL columns.

  • $contains_any: matches rows whose array contains any of the given values
  • $contains_none: matches rows whose array contains none of the given values

Both of those operators accept List[str] | List[int] | List[float] | str | float | int.
User should assure that input has the same type as the underlying PostgreSQL column.

Examples of usage:

# find docs tagged “audio” or “hydration”
{"tags": {"$contains_any": ["audio", "hydration"]}}

# exclude docs with those tags
{"tags": {"$contains_none": ["audio", "hydration"]}}

# multi‐column combo
{
  "$and": [
    {"dimensions": {"$contains_any": 25.0}},
    {"is_available": True}
  ]
}

Inspired by #146

@nazarpechka nazarpechka changed the title feat: add $contains_any and $contains_none operators for filtering feat: $contains_any and $contains_none operators for array-inclusion filtering Jun 30, 2025
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