如何在单独的有角度的Firestore集合上进行内部联接?

问题描述 投票:0回答:1

我目前正在尝试建立一个网站,用户可以在其中使用4个单独的过滤器(例如类型,位置等)来指定他们希望查看的数据。我最初在尝试查询Firebase时使用多个'in'或'array-contains-any'运算符时遇到问题,因为我只允许使用其中一个运算符(例如,我不能在x中键入, y中的位置,依此类推。

由于这个原因,我的想法是将这些查询分开,让每个过滤器自己查询firebase,然后将所有这些集合进行内部连接,成为具有正确数据的集合(例如,具有所有机会的集合从位置y输入x,条件为z)。但是,不幸的是,我不确定如何对这3个不同的集合进行内部联接。如果可以的话,我将不胜感激

    // Step 1: Filter by the type of the opportunity
    if (isFilterType){
      this.typeColl = this.afs.collection<Opportunity>('opportunities', ref => ref.where('oppoType','in',oppoType))
    }

    // Step 2: Filter by the location of the opportunity itself
    if (isFilterLocation){
      this.locationColl = this.afs.collection<Opportunity>('opportunities', ref => ref.where('location','in',location))
    }

    // Step 3: Filter by the requirements that the opportunity has
    if (isFilterRequirements){
      this.requirementsColl = this.afs.collection<Opportunity>('opportunities', ref => ref.where('requirements','array-contains-any',requirements))
    }
angular firebase google-cloud-firestore angularfire
1个回答
0
投票
© www.soinside.com 2019 - 2024. All rights reserved.