带有逻辑运算符的Angular Fire查询

时间:2019-07-12 21:07:32

标签: angular typescript angularfire

编写一个简单的集合的Angular Fire查询,想知道是否有可能在ref => ref.where()查询中添加逻辑运算符。

特别希望返回满足两个选项之一的值。

查询返回的是我期望的对象,但是我很好奇是否可以通过Angular Fire修改逻辑中的.where输入。

getUserExchanges(){
  this.userExchanges = 
      this.afs.collection('exchanges', ref => 
ref.where('recipientUid', '==', `${this.currentUser.uid}`)).snapshotChanges()

       return this.userExchanges
}

是否可以做类似的事情:

getUserExchanges(){
  this.userExchanges = 
      this.afs.collection('exchanges', ref => 
ref.where('recipientUid' || 'authorUid' , '==', `${this.currentUser.uid}`)).snapshotChanges()

       return this.userExchanges
}

0 个答案:

没有答案