【发布时间】:2019-10-27 16:47:12
【问题描述】:
我想在前端设置我的文档ID,同时我set文档,所以我想知道是否有一种方法可以生成Firestore ID,它可能看起来像这样:
const theID = firebase.firestore().generateID() // something like this
firebase.firestore().collection('posts').doc(theID).set({
id: theID,
...otherData
})
我可以使用 uuid 或其他一些 id 生成器包,但我正在寻找 Firestore id 生成器。 This SO answer 指向一些newId method,但是我在JS SDK 中找不到... (https://www.npmjs.com/package/firebase)
【问题讨论】:
标签: javascript firebase google-cloud-firestore