Vin*_*rad 5 angularjs firebase ionic-framework firebase-realtime-database
架构:
我正在尝试按所有者过滤所有对象
为了获得具体的信息,我这样做:
var refCompaniesById = firebase.database().ref('companies').child(id);
Run Code Online (Sandbox Code Playgroud)
但在这种情况下我想过滤所有
我试过:
ref.child('companies').child().set({"owner": id})
Run Code Online (Sandbox Code Playgroud)
但我失败了。
firebase.database().ref('companies').orderByChild('owner').equalTo(id)
.once('value')
.then(snapshot => {
const records = snapshot.val();
console.log(`Companies whose owner id is ${id}: `, records);
})
.catch(error => console.log(error));
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
2461 次 |
| 最近记录: |