Google cloud firestore 如何从云函数添加具有AutoID的firestore文档?
在我的职能中,我有以下几点:Google cloud firestore 如何从云函数添加具有AutoID的firestore文档?,google-cloud-firestore,google-cloud-functions,Google Cloud Firestore,Google Cloud Functions,在我的职能中,我有以下几点: await admin.firestore() .collection("development") .doc("development") .collection("users") .doc(userId) .collection("tokens") .doc("{autoId}") .set(token, {merge: true});
await admin.firestore()
.collection("development")
.doc("development")
.collection("users")
.doc(userId)
.collection("tokens")
.doc("{autoId}")
.set(token, {merge: true});
在tokens集合中,我想创建一个带有autoID的文档。其他一切似乎都很好。但是,当我检查firestore时,文档名为{autoId},而不是生成实际的ID
感谢您的帮助!:) 只需将参数保留到最后一个.doc为空,即
.doc()
。“{autoId}”不是Firestore的标志-它只是一个字符串。只需将参数保留为最后一个.doc为空-即.doc()
。“{autoId}”不是Firestore的标志-它只是一个字符串