reactjs - 无法通过在 REACT 中使用 Google 身份验证使用登录 ID 从 Firestore 读取数据。我的数据以当前使用的 ID 保存在 Firestore 中
问题描述
[无法通过使用谷歌身份验证的登录 ID 来读取来自 Firestore 的数据。我检查了我的数据是否以当前使用的 ID 保存在 Firestore 中。]
db.collection('demo').where('uid', '=', firebase.auth().currentUser.uid)
.get()
.then(snapshot => {
const demo = []
snapshot.forEach(doc =>{
const data = doc.data()
demo.push(data)
})
this.setState({demo:demo})
})
.catch(error => console.log(error))
})
解决方案
您所做的查询不正确,您应该使用==
而不是=
,所以它应该如下所示:
db.collection('demo').where('uid', '==', firebase.auth().currentUser.uid)
推荐阅读
- reactjs - 当 react-router-dom 链接与材料 ui ListItem onClick 一起使用时,反应状态未更新
- python - Pandas Groupby 剧情布局
- python - 在 matplotlib 中创建动态脚注文本
- node.js - NodeJs项目如何使用户输入未经处理?
- angular - 单元测试角度和茉莉花
- flutter - 在 Flutter 中自动为用户移动可拖动对象到拖动目标
- javascript - 我有一些简单的 JavaScript 代码,我想把它变成一个弹出扩展。我该怎么做呢?
- android - 带有导航组件的 Google Play Instant Apps:默认 URL “https://example.com”未映射到您的 Instant 应用程序
- c - e^-x 的近似值没有返回正确的值
- oracle - 寻求有关 Oracle 数据密集型应用程序的建议