使用下面的查询,我可以获取文档并使用doc.data().name来获取键“name”的值。我想要获取该文档中的所有键。如何获取?
var docRef = db.collection("cities").doc("SF");
docRef.get().then(function(doc) {
if (doc.exists) {
console.log("Document data:", doc.data());
//**I want to get all keys in the document here.**
} else {
// doc.data() will be undefined in this case
console.log("No such document!");
}
}).catch(function(error) {
console.log("Error getting document:", error);
});