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

collection.findByIds() accepts chain queries, but does nothing with them #6148

Open
MrChadMWood opened this issue Jun 25, 2024 · 1 comment

Comments

@MrChadMWood
Copy link

MrChadMWood commented Jun 25, 2024

As seen below, I try querying with chained operators in order to add additional conditions to findByIds. In practice, I'm trying to get records from the array of IDs where actual_finish_date=null. For demonstration purposes, I'm searching for 'some-fake-value'.

Following, I convert the returned Map into an array to see the values returned. Based on the accepted query, I would expect all returns to have the value of actual_finish_date='some-fake-value'. However, I'm simply given all records that match the array of IDs, without any filtration done based on the value of actual_finish_date.

This is therefore the wrong result to my query. If findByIds does not support chained queries, I would guess an error should be thrown. The acceptance of the query is what confuses me. Would the bug be the lack of filtration, or the acceptance of the chained query?

12:16:39.715 >>> test = await database.collections.space_task_schedule.findByIds(spaceTaskIds).where('actual_finish_date').eq('some-fake-value').exec()
12:16:39.745 Map(69) { 66 → {…}, 504 → {…}, 940 → {…}, 1377 → {…}, 1814 → {…}, 2251 → {…}, 2688 → {…}, 3125 → {…}, 3564 → {…}, 3999 → {…}, … }

12:16:44.625 >>> Array.from(test).map(d => d[1].actual_finish_date)
12:16:44.650 Array(69) [ null, null, null, null, null, null, null, null, null, null, … ]

Versions:

"rxdb": "15.24.0",
"rxdb-hooks": "5.0.2",
"rxjs": "7.8.1",

This is the case with Dexie and Memory storage.

@pubkey
Copy link
Owner

pubkey commented Jun 25, 2024

Hi @MrChadMWood
This is a good catch. Chained queries cannot be used on RxQuery instances that are created with findByIds. I will add a check to ensure this is properly shown to the developer.

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

2 participants