I have a function:
var Ref = db.collection('Test').doc('Document');
function fire() {
var getDoc = Ref.get()
.then(doc => {
if(doc.exists){
return doc.data().Num
}else{
return
}
})
.catch(err => {
console.log('Error getting document', err);
});
}
console.log(fire()); // undefined
How could I get this working so it returns the document from firestore? I need a function for what I am trying to do, I'm aware that you can do this regularly without one.