【发布时间】:2022-01-05 16:43:31
【问题描述】:
集合引用无效。集合引用必须有奇数个段,但 profile/undefined 有 2 个。
const user = await signUpNewUser(auth, email, password);
const docRef = await addDoc(collection(db, `profiles/${user.uid}`), {
nama: form.nama,
createdAt: new Date().getTime().toString(),
});
console.log("Document written with ID: ", docRef.id);
【问题讨论】:
-
在firebase中,第一个段是一个集合,第二个是一个文档,然后第三个将是集合,同样奇数段将是集合,偶数段将被记录。您正在尝试在文档部分创建一个集合。
-
你能不能再直接一点地问这个问题?您在代码之前的声明是您收到的错误消息还是对您的代码段的评论?
-
请澄清您的具体问题或提供其他详细信息以准确突出您的需求。正如目前所写的那样,很难准确地说出你在问什么。
标签: javascript reactjs firebase google-cloud-firestore