最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Invalid query. You cannot use more than one 'in' filter - Stack Overflow

programmeradmin2浏览0评论
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"

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"

Share Improve this question edited Mar 13, 2023 at 12:33 Renaud Tarnec 83.1k10 gold badges97 silver badges128 bronze badges Recognized by Google Cloud Collective asked Mar 1, 2020 at 11:46 Jolen QadarJolen Qadar 1791 gold badge1 silver badge8 bronze badges
Add a comment  | 

2 Answers 2

Reset to default 18

UPDATE:

Since the release of the Firebase JS SDK Version 9.18.0 on March 16, 2023 it is possible to combine several in clauses in a Query.

However note that "Cloud Firestore limits a query to a maximum of 30 disjunctions in disjunctive normal form", as explained in the documentation (which includes examples on the number of disjunctions for different types of queries)


OLD ANSWER:

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`
发布评论

评论列表(0)

  1. 暂无评论