How To Handle Promise In Firestore
here is my code to check a doc is there in the collections this.shopCollection = this.afs.collection('shops', ref => { return ref.where('fulladdress', '==', myStri
Solution 1:
I got it working with some changes
Here is my code
this.afs.collection<Shop>('shops').ref.where('fulladdress', '==', myString)
.get()
.then(res => {
if(res.docs.length == 0){
//no documents found
}else{
//you got some documents
res.forEach(shop => {
console.log(shop.id);
console.log(shop.data());
})
}
}).catch(err => {
console.log('something went wrong '+ err)
});
i am not sure this is the right way, works fine for me.
Post a Comment for "How To Handle Promise In Firestore"