【发布时间】:2020-06-20 15:42:16
【问题描述】:
在名为“医生”的 Firestore 集合中,有不同的字段,包括字段“角色”。我想将医生添加到具有名为医生的角色的 Firestore 中。我怎样才能做到这一点?以下是成功将数据添加到数据库中的代码。如果可以,请告诉我添加具有特定字段名称的数据的方法。提前致谢。
service.ts
create_Newdoctor(Record){
return this.firestore.collection('doctors').add(Record);
}
组件.ts
CreateRecord(docForm: NgForm){
let Record = {};
Record['fullName']=this.fullName;
Record['email']=this.email;
this.DoctorService.create_Newdoctor(Record).then(res=> {
this.fullName="";
this.email="";
console.log(res);
this.message = "Added";
}).catch(error=>{
console.log(error);
});
}
【问题讨论】:
标签: firebase google-cloud-firestore angular9