【发布时间】:2015-07-11 20:54:55
【问题描述】:
假设我的 Firebase 上有这些数据:
https://mygame.firebaseio.com/player
{
"player": {
"bloodgulf01": {
"username": "bloodgulf01",
"uid": "twitter:102032",
"level": 2,
"map": 3,
"x": 51,
"y": 12
},
"damjanovic": {
"username": "damjanovic",
"uid": "github:77371",
"level": 5,
"map": 2,
"x": 21,
"y": 44
}
}
}
我如何通过uid 搜索并获得snapshot 的结果?
这是我尝试过的:
new Firebase("https://mygame.firebaseio.com/player")
.startAt(authData.uid)
.endAt(authData.uid)
.once('value', function(snap) {
console.log('accounts matching UID of ' + authData.uid, snap.val())
});
返回:accounts matching UID of github:123456789 null 尽管uid 在/player/ 的数据中...
【问题讨论】:
标签: javascript json firebase