Reputation: 571
I have created the following database:
db.collection('users').doc(usercred.user.uid).set({
"uid": usercred.user.uid,
"phone": usercred.user.phoneNumber,
"active-image-size-limit": 1500,
"credits": 10,
"active-temp": temName
});
How can I access the "active-temp" field in partuicular ?
Upvotes: 0
Views: 89
Reputation: 80952
To retrieve active-temp
do the following:
var docRef = db.collection("users").doc(usercred.user.uid);
docRef.get().then(function(doc) {
if (doc.exists) {
console.log(doc.data()["active-temp"]);
} else {
// doc.data() will be undefined in this case
console.log("No such document!");
}
}).catch(function(error) {
console.log("Error getting document:", error);
});
doc.data()
will contain all the data
Upvotes: 1