My query is:
snapshot = await FirebaseFirestore.instance
.collection('dialogs')
.where('active', isEqualTo: true)
.where('users', arrayContains: globals.user.userId)
.where('readers', whereNotIn: [globals.user.userId])
.orderBy('priority')
.limit(1)
.get();
I'm getting the above exception:
Unhandled Exception: [cloud_firestore/unknown] An error occurred while parsing query arguments, see native logs for more information.
I have found some notes on the official Firestore documentation:
not-in
, or array-contains-any
clause per query. You can't combine these operators in the same query.All should be just fine in my case.
Also I have tried several things:
whereNotIn
line, everything is just fine.arrayContains
line, everything is just fine.Why am I getting a query parsing exception? Thanks
Firestore query documentation was not up to date (relevant for 04.04.21).
I have checked my android Logchats on android studio and found out that:
Invalid Query. You cannot use 'not_in' filters with 'array_contains' filters.
While firebase documentation says that:
You can use at most one in, not-in, or array-contains-any clause per query. You can't combine these operators in the same query.
It was not mentioned on the Firebase documentation that array-contains
cannot be at the same query along with not-in
.
If you are encountered with query parsing exception. The most updated and fastest way to get relevant information about the problem is to check your Logchats.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With