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

Query by nested fields does not work #3

Open
pavvell opened this issue Feb 7, 2024 · 0 comments
Open

Query by nested fields does not work #3

pavvell opened this issue Feb 7, 2024 · 0 comments

Comments

@pavvell
Copy link

pavvell commented Feb 7, 2024

hi! it seems that the library supports creating indexes on nested fields, but in reality I can't make it work.

for example, I have records like this:

{ productId: 'product-1',  data: { name: 'name of the product', productId: 'product-1', score: 1 } }

If I create index on a nested field:

const nestedIndex = productsCollection.createIndex({
        name: "nested_products_ids_index",
        terms: ["data.productId"],
    });

I get 0 results when I query it:

const queryProducts = await productsCollectionIndex.match({
        "data.productId": ['product-1'],
    })

but if I create index using only productId on the top level, it works:

const productsCollectionIndex = productsCollection.createIndex({
        name: "products_ids_index",
        terms: ["productId"],
    });

I get the results. is it supposed to work this way, and nested fields are not supported or is this is a bug? thanks!

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

No branches or pull requests

1 participant