【发布时间】:2019-03-07 10:39:24
【问题描述】:
我需要保持我的 firebase 数据库同步,所以我做了一些搜索,发现我可以使用 keepsynced(true) 因为默认情况下,Firebase 会在缓存中保留 10mb 数据,如果它进一步增长,它将被新数据取代 所以我就这样使用它 (在故障的节点应用上使用 firebase)
var locationRef = admin
.database()
.ref()
.child("locations");
locationRef.keepSynced(true);
locationRef.once('value').then(function(snapshot) {
snapshot.forEach(function(childSnapshot) {
var childKey = childSnapshot.key;
var childData = childSnapshot.val();
console.log(childData);
presseLocations.push(childData)
});
但我收到此错误:
locationRef.keepSynced is not a function
有什么想法吗?
【问题讨论】:
标签: javascript firebase firebase-realtime-database