提取具有多个where条件问题的数据

时间:2020-09-08 07:17:59

标签: firebase google-cloud-firestore angularfire2

我正在尝试从具有两个collection条件的where获取数据。我面临的问题是,我需要按两次获取数据按钮。我不明白为什么。

这是我的功能:

 async get_data(){
    
    console.log(this.mnth);
    console.log(this.selected_user_authId);
    //where condition
await this.firestore.collection("complaints",ref => ref
.where("complaint_agent_id", "==", this.selected_user_authId)
.where("complaint_date_month", "==", this.mnth)
.orderBy('ticketid', 'desc')
)
    .get()
    .subscribe(response => {
      console.log("insidesub")
      if(!response.docs.length){
        console.log("no data available");
        return false;
      }
      this.goalList=[];
      for(let item of response.docs){
             var data = Object.assign(item.data(), {docid : item.id})
             this.goalList.push(data);
      }
    }
    console.log(this.goalList);
  )}

我的 console.log 屏幕截图

enter image description here

我的索引图像,我单击console.log中的链接以创建此索引

enter image description here

哪里可能出问题了?

0 个答案:

没有答案