我想在 Firestore 中的集合中设置实际值之前生成一个 key 。在 firebase 中,语法类似于 firebase.database().ref().child('myposts').push().key
。
如何在 firestore
中执行此操作。
最佳答案
我用...
构造函数(私有(private) afs:AngularFirestore){}
pushkey = this.afs.createId()
那么你可以这样做
this.afs.collection("你的收藏").doc(this.pushkey).add({id:this.pushkey, name: "chris"})
关于javascript - 在 firestore 中创建 key ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55886472/