【发布时间】:2020-10-10 19:08:51
【问题描述】:
我正在尝试从 firestore 获取文档值,但我的查询出现错误。
这是 Firebase 中的路径:
/users/currentuser.uid/confirmed-appointments/10/10
这是我的使用效果:
useEffect(() => {
const currentMonth = new Date().getMonth() + 1; //Later be used here
firebase
.firestore()
.collection("users")
.doc(uid)
.collection("confirmed-appointments")
.doc("10") //10 = october , 11 = november , 12 = december and etc....
.get().then(function(doc) {
if (doc.exists) {
console.log("Document data:", doc.data());
} else {
// doc.data() will be undefined in this case
console.log("No such document!");
}
})
}, [])
我想浏览 10 月 10 日内的所有文档
【问题讨论】:
标签: javascript firebase react-native google-cloud-firestore