相关疑难解决方法(0)

查询基于Firebase中的多个where子句

{
"movies": {
    "movie1": {
        "genre": "comedy",
        "name": "As good as it gets",
        "lead": "Jack Nicholson"
    },
    "movie2": {
        "genre": "Horror",
        "name": "The Shining",
        "lead": "Jack Nicholson"
    },
    "movie3": {
        "genre": "comedy",
        "name": "The Mask",
        "lead": "Jim Carrey"
    }
  }  
 }
Run Code Online (Sandbox Code Playgroud)

我是Firebase的新手.我如何可以检索从上面的数据结果,其中genre = 'comedy'lead = 'Jack Nicholson'

我有什么选择?

firebase firebase-realtime-database

227
推荐指数
3
解决办法
15万
查看次数

如果子项的子项包含值,则为Firebase查询

表的结构是:

  • 聊天记录
  • - > randomId
  • - > - >参与者
  • - > - > - > 0:'name1'
  • - > - > - > 1:'name2'
  • - > - > chatItems

等等

我想要做的是查询聊天表,找到通过传入的用户名字符串保存参与者的所有聊天.

这是我到目前为止:

 subscribeChats(username: string) {
    return this.af.database.list('chats', {
        query: {
            orderByChild: 'participants',
            equalTo: username, // How to check if participants contain username
        }
    });
 }
Run Code Online (Sandbox Code Playgroud)

firebase firebase-realtime-database angularfire2 angular

55
推荐指数
1
解决办法
1万
查看次数