Firebase - Firestore - get key with collection.add()

后端 未结 4 750
渐次进展
渐次进展 2020-12-01 16:31

I am facing a problem with the new Firestore from Firebase.

Situation: I have a collection(\'room\')

I create room with c

4条回答
  •  一个人的身影
    2020-12-01 16:58

    Firebase Javascript SDK:

    Just use .id to get the key, here is an example using async/ await :

      const KEYID = async() => (await fs.collection("testing").add({ data: 'test'})).id;
    

提交回复
热议问题