Firebase Firestore指南显示如何使用以下内容迭代集合快照中的文档forEach:
db.collection("cities").get().then(function(querySnapshot) {
querySnapshot.forEach(function(doc) {
console.log(doc.id, " => ", doc.data());
});
});
Run Code Online (Sandbox Code Playgroud)
我想它也会支持map,但事实并非如此.如何映射快照?
我将用户的分数存储在Google Cloud Firestore中,因为每个分数在集合中名为“ points ” 的新文档中得分。
集合名称:点数
我想对值字段中的所有值求和。
我有很多次Google,但一无所获。sum()是否有其他选择或实现用户记录分数的任何其他方法?