firebase - 如何过滤字段值并将数据发送到 Firestore 集合?
问题描述
在名为“医生”的 Firestore 集合中,有不同的字段,包括字段“角色”。我想将医生添加到具有名为医生的角色的 Firestore 中。我怎样才能做到这一点?以下是成功将数据添加到数据库中的代码。如果可以,请告诉我添加具有特定字段名称的数据的方法。提前致谢。
服务.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);
});
}
解决方案
推荐阅读
- json - 如何在swift 3中使用数组和字符串进行json
- php - 单页长时间响应需要异步
- c++11 - ifstream 检查读取错误
- c# - ““XamlCTask”任务意外失败。” 错误
- ruby-on-rails - 在 rails 中使用 simple_form 动态添加用户输入
- python - 使用 Pandas 构建天然气远期价格带的时间序列
- javascript - D3 沿右轴对齐文本
- r - 使用 str_split 并从 R 中的同一记录中删除重复值
- cassandra - Cassandra 节点处于活动状态(已退出)?
- openstack - 是否有基于 Xen 与 KVM 以 PV 模式运行的 OpenStack 发行版?