Skip to content
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

Support filter's dot notation for arrays #838

Open
rumyantseva opened this issue Feb 16, 2023 · 3 comments
Open

Support filter's dot notation for arrays #838

rumyantseva opened this issue Feb 16, 2023 · 3 comments
Labels
enhancement New feature or request SecondaryIndexes

Comments

@rumyantseva
Copy link

Is your feature request related to a problem? Please describe.

To support more user queries, we need the ability to use "dot notation" in the filter when searching for values in arrays.

Examples:

  • foo.0.bar.1 - to address the exact array value with the given indexes
  • foo.bar - to address any array element in foo.*.bar.* arrays

Usage example:

filter = `{"foo.0.bar.1": "hello"}` // the exact array element is "hello"
filter = `{"foo.bar": "hello"}` // any element of `foo.*.bar.*` array is "hello"

Additional context

To support more query pushdown cases in FerretDB.

@himank
Copy link
Collaborator

himank commented Feb 16, 2023

@garrensmith let's think about this use case as well for filtering on array fields.

@garrensmith
Copy link
Contributor

Nice. This should be possible with the secondary indexes. We have to change the keybuilder and filter to support nested queries. The part I'm uncertain around is the foo.Position1.bar.Position2 I think that part would have to be done in memory.

@kesavkolla
Copy link

Add support for lambda style filtering. There are two examples we can refer to:

duckdb nested functions: https://duckdb.org/docs/sql/functions/nested - list_filter
jsonpath - https://goessner.net/articles/JsonPath/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request SecondaryIndexes
Projects
None yet
Development

No branches or pull requests

5 participants