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

Error when using "isNotEqualTo" operator is the Firestore querry. #155

Open
ben55j opened this issue May 7, 2023 · 1 comment
Open

Error when using "isNotEqualTo" operator is the Firestore querry. #155

ben55j opened this issue May 7, 2023 · 1 comment

Comments

@ben55j
Copy link

ben55j commented May 7, 2023

Hello,

I get on error when using the "isNotEqualTo" in the querry for comparing 2 strings values.
Here is the querry line, Knowing that "ownerUid" is a string field in my groups collection:
query: FirebaseFirestore.instance.collection("groups").where("ownerUid", isNotEqualTo: "abcde12456").orderBy("createdDate"),
Here the error I get from the console:
════════ Exception caught by widgets library ═══════════════════════════════════ The following assertion was thrown building ScreenInvitations(dirty, state: _ScreenInvitationsState#d8dc3): The initial orderBy() field "[[FieldPath([createdDate]), false]][0][0]" has to be the same as the where() field parameter "FieldPath([ownerUid])" when an inequality operator is invoked. 'package:cloud_firestore/src/query.dart': query.dart:1 Failed assertion: line 489 pos 13: 'conditionField == orders[0][0]'

I am using : kr_paginate_firestore: ^1.0.1

@AdnanKhan45
Copy link

AdnanKhan45 commented Aug 23, 2023

Hello ben55j,

I think the solution I'm about to provide is late but it might help others if you've already fixed it.

While using inEquality in query it's compulsry to use orderBy as displayed in the README.md.

firebaseFirestore.collection(FirebaseCollectionConst.users) .where("uid", isNotEqualTo: uid) .orderBy("uid")

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