Javascript 通过Firebase Admin访问深层数据
如何通过Firebase Admin访问深层数据 数据:Javascript 通过Firebase Admin访问深层数据,javascript,firebase,firebase-realtime-database,firebase-admin,Javascript,Firebase,Firebase Realtime Database,Firebase Admin,如何通过Firebase Admin访问深层数据 数据: { "keyboards": { "StartKeyboard": [ "KeyboardA", "KeyboardB", "KeyboardC" ], "SecendKeyboard": { "parent": "StartKeyboard", "childs":
{
"keyboards": {
"StartKeyboard": [
"KeyboardA",
"KeyboardB",
"KeyboardC"
],
"SecendKeyboard": {
"parent": "StartKeyboard",
"childs": [ //*** I need to get this childs: [] ***
"Keyboard1",
"Keyboard2",
"Keyboard3"
]
}
}
}
当我使用下面的代码时,我的输出中有所有数据
const ref = db.ref('/'); All Data
ref.on("value", function (snapshot) {
console.log(snapshot.val());
});
const ref = db.ref('keyboards'); // inside of Keyboards
ref.on("value", function (snapshot) {
console.log(snapshot.val());
});
当我使用下面的代码时,我在输出中有键盘的孩子
const ref = db.ref('/'); All Data
ref.on("value", function (snapshot) {
console.log(snapshot.val());
});
const ref = db.ref('keyboards'); // inside of Keyboards
ref.on("value", function (snapshot) {
console.log(snapshot.val());
});
但是我不知道如何获得SecendKeyboard的childs
。
我指的是Keyboard1
和Keyboard2
和Keyboard3
的数组。
谢谢。要获得键盘儿童:
const ref = db.ref('keyboards/SecendKeyboard/childs');
ref.on("value", function (snapshot) {
console.log(snapshot.val());
});
或:
或