I'm looking for the best way to:
1. query for one single result, or
2. extract the first result from the query
tried: collection[0] and collection.pop() or collection.shift() and nothing works
I really don't like the code i'm using, but it works...
export const findUserByEmail = email => {
return firestore()
.collection('users')
.where('email', '==', email.toLowerCase())
.get()
.then(collection => {
console.log(collection)
let user
collection.forEach(doc => user = doc.data())
return user
})
}