aliakgul
aliakgul

Reputation: 35

Flutter Firestore: specific documents from a collection (Firestore.collection.where)

I am using Firebase Cloud Firestore, and I want to pick specific documents from a collection. I want to call documents whose permission field is 'everyone' or 'groupA'.

stream: Firestore.instance
    .collection('Posts')
    .orderBy('date')
    .where('permission', isEqualTo: 'everyone')
    .where('permission', isEqualTo: 'groupA')
    .snapshot(),

I tried this but it is trying to bring me the intersection. I also tried:

    .where('permission', arrayContains: 'everyone')
    .where('permission', arrayContains: 'groupA')

But this gives me errors.

Upvotes: 1

Views: 398

Answers (1)

Samuel Silva
Samuel Silva

Reputation: 697

Firebase does not support logical OR queries. In this case, you should create a separate query for each OR condition and merge the query results in your app.

Upvotes: 1

Related Questions