如何从实时数据库而非Firestore获取文档ID? 我需要通过javascript
获取文档ID的列表答案 0 :(得分:0)
设置配置并初始化firebase:
var firebaseConfig = {
//You can get the necessary information in you project console
};
// Initialize Firebase
firebase.initializeApp(firebaseConfig);
这将为您提供参考孩子的钥匙:
var myRef = firebase.database().ref(//path to you data);
var keys = [];
myRef.once("value", function(snapshot){
documents=Object.keys(snapshot.val());
for(d in documents){
keys.push(documents[d]);
}
}