我有这个简单的查询:
var userz = firebase.database().ref()
.child("accounts")
.orderByChild("userId")
.equalTo(fbid)
.once("value", function(snapshot) {
...
});
有了这个结构:
- 帐户
---- 身份证
-------- 姓名
-------- 用户名
-------- vendor
当我询问 snapshot.key 时,我得到了“accounts”值。
我只想知道在执行此查询时我得到了哪个“IdAccount”值,但我不知道该怎么做。
最佳答案
我将“value”更改为“child_added”,它起作用了!
var userz = firebase.database().ref()
.child("accounts")
.orderByChild("userId")
.equalTo(fbid)
.once("child_added", function(snapshot) {
...
});
关于javascript - Firebase 如何从查询中获取父节点,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41915916/