angularfire2 - 如何在 firebase 中使用多个 where 子句?
angularfire2 - how can use multiple where clauses in firebase?
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));
});
当我使用上面的代码片段时,我从智能感知中得到了错误:
[ts] An object literal cannot have multiple properties with the same
name in strict mode.
[ts] Duplicate identifier 'orderBy'.
使用多次 orderBy 的原因是:
我不会在类似
的地方查询多个child
select * from user where key1='val1' and key2='val2'
无法在 firebase 中实现上述 SQL 查询吗?
我使用:
angularfire2 : 4.0.0-rc.0
可以传入list
格式
试试这个
query: {
orderBy: ["key1","key2"],
equalTo: 'val1'
}
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));
});
当我使用上面的代码片段时,我从智能感知中得到了错误:
[ts] An object literal cannot have multiple properties with the same name in strict mode.
[ts] Duplicate identifier 'orderBy'.
使用多次 orderBy 的原因是:
我不会在类似
的地方查询多个childselect * from user where key1='val1' and key2='val2'
无法在 firebase 中实现上述 SQL 查询吗?
我使用:
angularfire2 : 4.0.0-rc.0
可以传入list
格式
试试这个
query: {
orderBy: ["key1","key2"],
equalTo: 'val1'
}