I have this function:
var db = firebase.firestore();
var perRef =
db.collection("personas").where("edad","==",33);
perRef.get()
.then(function(querySnapshot) { querySnapshot.forEach(function(doc) {
console.log("data:" + doc.data().nombre );
});
})
.catch(function(error) {
console.log("Error: " , error);
});
my problem is that I do not know how to return null if there is no document inside the foreach, and that document does exist I want to return it but without sending it to another function and I do not know how