Invalid query. You cannot use more than one 'in' filter

Viewed 9834
this.ref.collection("users", ref => ref.where("uid1","in", [reciverId, senderId])
        .where("uid2","in", [reciverId, senderId]))

give me error like

"Invalid query. You cannot use more than one 'in' filter"

2 Answers

This is indeed a limitation of Firestore, as explained in the documentation:

Limitations

Note the following limitations for in and array-contains-any:

  • in and array-contains-any support up to 10 comparison values.
  • You can use only one in or array-contains-any clause per query. You can't use both in and array-contains-any in the same query.
  • You can combine array-contains with in but not with array-contains-any.
 this.messages_collection = this.afs.collection<ChatMessage>('messages',
  ref => ref.where('email', 'in', [this.user.email, this.receiver.email])
    .where('receiver_email', 'in', [this.user.email, this.receiver.email])
    .orderBy('timesent')
);`enter code here`
Related