Reputation: 221
When I try to query a document that I've set up using the firebase console I don't get anything back that looks like the data I've entered.
I've tried console logging the collection as well but get nothing back from that either. I've checked that the firebase config is correct but it seems fine.
let doc = firebase.firestore().doc(`users/${this.userId}`)
console.log('doc', doc)
In trying to console.log the document I get the following response
I was expecting the collection or just the document to appear in the console log with all the data from firestore.
Upvotes: 0
Views: 2443
Reputation: 2301
There are three concepts to know here:
let docRef = db.collection("objects").doc("singleObjectWithDataFields")
is the reference.
docRef.get().then(function(doc){
returns the document
doc.data()
returns the data fields, which map either to values, or to maps which are complex nested objects
Upvotes: 2