Closed gmarizy closed 8 months ago
+1 for me it does not return any results
All my where queries return no result
Yep. I replaced all the queries with direct queries. The only dependency I have is now on model objects.
On Wed, Feb 21, 2024 at 4:56 PM Dor Klein @.***> wrote:
All my where queries return no result
— Reply to this email directly, view it on GitHub https://github.com/FirebaseExtended/firestoreodm-flutter/issues/7#issuecomment-1956445140, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAQ4MLQBIPSUUMFNXPG7YH3YUXKXFAVCNFSM6AAAAABDCV466OVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSNJWGQ2DKMJUGA . You are receiving this because you commented.Message ID: @.***>
Same here. All get queries using any kind of .where
now return 0 results with no error.
final configs = await configurationRef
.whereCreatedBy(isEqualTo: userId)
.wherePartNumber(isEqualTo: partNumber)
.whereDeleted(isEqualTo: false)
.get();
Switching to direct queries works
@rrousselGit This looks to be a pretty nasty bug. Do you have some free time to take a look? It might be related to the recent isEqual
change.
I can confirm this behavior. Turning on debug logging for cloud_firestore shows why the odm queries dont return results.
In my case the generated query with where clause is containing duplicated query fields with each a valid value and a null value using the AND operator. This is not limited to only to isEqual.
Duplicated query fields with null in bold below.
(24.10.1) [QueryEngine]: Using full collection scan to execute query: Query(target=Query(test_collection where created_by==X3xty1MuGBhb951AQ27p54WIU9p2 and created_by==null and is_completed==true and is_completed==null and expires_date>=time(1708821339,589398000) and expires_date!=null order by expires_date, name);limitType=LIMIT_TO_FIRST)
@rrousselGit My best guess is the _WhereMapper is doing double duty with broken logic.
I have created a sample project you can use to reproduce this, if that helps.
https://github.com/urbanmania/test_project
If you run it as is you will get the error.
If you comment out this line the error is gone (but also the access control) https://github.com/urbanmania/test_project/blob/0931902c0feb202212a792f9cffe33d74363cd85/lib/main_list_view.dart#L15
It is not the first time I've seen this error, previously it broke and then magically got fixed but broke again with the latest update.
It appears no maintainer is actively watching this project anymore since the transfer ... While beeing under firebase/flutterfire there was at least some kind of action.
To me it looks like an abandoned project.
It isn't abandoned by any means. It's not receiving any more or less updates than before.
The previous "weekly release" was just an automatic one made when Firebase was released – bumping side-packages alongside it.
Now that it's in a separate repo, the automatic release doesn't happen anymore, that's all.
There's no real bug here. It's because your ODM version is higher than your Firestore version. You use firestore <4.15.0, but the latest ODM.
I'll bump the minimum Firestore version necessary to fix – and fix a bug specific to arrayContains. But otherwise, it's working well.
@rrousselGit my ODM version is not higher than my firestore version; as written in the initial issue, I produce the bug with cloud_firestore version 4.15.4.
I tested again with: cloud_firestore_odm: 1.0.0-dev.83 cloud_firestore: 4.15.6 and: cloud_firestore_odm: 1.0.0-dev.84 cloud_firestore: 4.15.6
The bug is still there.
You're right, there is a separate issue specifically with how the ODM passes isNull
. I'll fix it
I confirm it's fixed, thank you @rrousselGit.
As a side note, I don't know if it's intended but there is a discrepancy of version between cloud_firestore_odm which stayed 1.0.0-dev.84 while cloud_firestore_odm_generator have been pushed to 1.0.0-dev.85.
Confirming this issue is fixed ! Thx @rrousselGit !
Not quite sure why, but this isn't fixed for us. Downgrading to 82 helps, but 84 isn't working.
Some sample code:
SomeCollectionReference(firestore)
.whereFieldPath(FieldPath(const ["creator"]), isEqualTo: uid)
.snapshots()
SomeCollectionReference(firestore)
.whereCreator(isEqualTo: uid)
.snapshots()
Both of these stopped working, creator
is a string field, uid
is guaranteed to not be null
.
@ciriousjoker dev version 84 of generator is flawed, you have to use the 85.
In my pubspeck.yaml
:
cloud_firestore_odm: 1.0.0-dev.84
cloud_firestore_odm_generator: 1.0.0-dev.85
After upgrading and flutter pub get
I just run flutter pub run build_runner build --delete-conflicting-outputs
and it was all good.
@gmarizy ah yes thanks! Forgot to regenerate the files after updating. Now it's working!
Expected Behavior
Same behavior between 1.0.0-dev.82 and 1.0.0-dev.83
Actual Behavior
Some requests fail with error like "You cannot use '!=' filters more than once", even in request where there is only isEqualTo where clauses, after updating to 1.0.0-dev.83.
Steps to Reproduce the Problem
Specifications