gpt4 book ai didi

node.js - Cloud Functions for Firebase 遍历子 Node

转载 作者:搜寻专家 更新时间:2023-10-31 22:39:01 25 4
gpt4 key购买 nike

我刚开始使用 firebase Functions,我是 node.js 环境的新手,有人可以告诉我如何遍历子 Node 并获取子值。

最佳答案

看这个例子:

  const parentRef = admin.database().ref("path");
return parentRef.once('value').then(snapshot => {
const updates = {};
snapshot.forEach(function(child) {
updates[child.key] = null;
});
return parentRef.update(updates);
});

关于node.js - Cloud Functions for Firebase 遍历子 Node ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43418242/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com