我正在寻找最好的方法来:a)查询一个结果,或者b)从查询中提取第一个结果
尝试:result[0]
和result.pop()
,什么都不起作用
我真的不喜欢我正在使用的代码,但是它可以工作...
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
})
}
[[0]中有一个限制属性