如果更改
.set为,您的代码应该可以工作
.add。然后,Cloud
Firestore将为该文档发出新的ID。如果要指定文档ID,则需要执行此操作…
设置具有给定ID的书
db.collection('users').doc(this.username).collection('booksList').doc(myBookId).set({ password: this.password, name: this.name, rollno: this.rollno})本页详细介绍如何向CloudFirestore添加数据
新增书籍
db.collection('users').doc(this.username).collection('booksList').add({ password: this.password, name: this.name, rollno: this.rollno})


