Following code inserts data into the 'doctors' collection in firestore. But I want to add the same data records into another collection named 'next' in the same firestore database simultaneously.
service.ts
create_Newdoctor(Record){
return this.firestore.collection('doctors').add(Record);
}
component.ts
CreateRecord(docForm: NgForm){
let Record = {};
Record['fullName']=this.fullName;
Record['email']=this.email;
Record['gender']=this.gender;
Record['role']="doctor";
this.DoctorService.create_Newdoctor(Record).then(res=> {
this.fullName="";
this.email="";
this.gender="";
console.log(res);
this.message = "New doctor added";
}).catch(error=>{
console.log(error);
});
}
Can you please tell me a way to do this.Thank you in advance.