const chatdb = db.collection("users").get();
chatdb.then((snapshot) => {
return snapshot.docs.map((doc) => {
if (doc.data().email == userEmail) {
return { name: doc.data().name, image: doc.data().image };
}
});
});
console.log(chatdb);
Here, chatdb
is returning Promise{<pending>}
, I dont know why, I am just learning the concept of promises and I tried many ways to return the object but everytime it returned as a promise.
I just need to log the object that I returned in the map
function
How to access the value of a promise? this doesn't helps