【问题标题】:angularfire2 - how can use multiple where clauses in firebase? [duplicate]angularfire2 - 如何在firebase中使用多个where子句? [复制]
【发布时间】:2017-11-06 04:35:04
【问题描述】:
this.db.list('key_threads/key_threadList', {  
            query: {
                orderBy: "key1",
                equalTo: 'val1', 
                orderBy: "key2",  // I GET ERROR HEARE
                equalTo: 'val2', 
            }
        }).subscribe(
            result => { 
                console.log('result ' + JSON.stringify(result));
           });

当我使用上面的代码 sn-p 时,我得到错误形式的智能感知:

[ts] 一个对象字面量不能有多个属性相同 严格模式下的名称。

[ts] 重复标识符“orderBy”。

使用多个时间 orderBy 的原因是:

我不会在 where clouse like 中查询多个孩子

select * from user where key1='val1' and key2='val2'

难道没有办法在firebase中实现上述SQL查询吗?

我用:

angularfire2:4.0.0-rc.0

【问题讨论】:

标签: angular firebase firebase-realtime-database angularfire2


【解决方案1】:

可以传入list格式

试试这个

query: {
    orderBy: ["key1","key2"],
    equalTo: 'val1'
}
猜你喜欢
  • 2017-07-19
  • 2016-10-23
  • 2017-06-26
  • 1970-01-01
  • 1970-01-01
  • 2012-10-13
  • 2016-10-06
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多