Firestore get document by id on angular 2
Try this code
this.itemscollection.doc(id).ref.get().then(function(doc) {
if (doc.exists) {
console.log("Document data:", doc.data());
} else {
console.log("No such document!");
}
}).catch(function(error) {
console.log("Error getting document:", error);
});
the key to success working with angular 2( when using the package angularFire2 ) with firestore is to know that all the firestore methods in their official documention that manipulate single doc like 'get' 'set' 'update' are child of the 'ref' method Example insted
firestore - this.itemscollection.doc(id).get()
angularfirestore2 - this.itemscollection.doc(id).ref.get()
-------------------------------------
firestore - this.itemscollection.doc(id).set()
angularfirestore2 - this.itemscollection.doc(id).ref.set()