¿如何在 angular fire 中使用 2 "where" 子句执行 angularfire 查询?

¿how to execute an angularfire query with 2 "where" clauses in angular fire?

我正在尝试使用 AngularFire 在同一字段中执行带有两个“where”子句的查询。当我只设置一个“where”时查询有效,但在使用两个子句时检索不到任何结果。使用 firebase 时相同的查询正常工作(不是 angular fire)

  query2(callback){
    this.resultingArray = [];

    let query =this.angularFirestore.firestore.collection("myCollection")

    //Doesn't work with two clauses:
    .where("date",">=",this.startDate).where("date","<=",this.endDate)

    //works with only one clause:
    //.where("date",">=",this.startDateISO)

    query.get().then((querySnapshot)=>{
      querySnapshot.forEach((docs) => {
        this.resultingArray.push(docs)
      })
     })
    .then(()=>{
          callback()
        }).catch((err)=>{
          console.log(err)
        })
     }

试试这个。

let query =this.angularFirestore.firestore.collection("myCollection", ref => {
  return ref.where("date",">=",this.startDate).where("date","<=",this.endDate);
});