I need to save the document id in collection. Mean when user save data it will also save the document id with data. Can any one please tell how can i do this. Thanks :)
create() {
// the user details are updated in firebase user list
this.groupDetails = {
groupname: this.Name,
description: this.description,
members: this.checked,
messages: [],
createdId: this.user.userId,
createrName: this.user.username
}
console.log(this.groupDetails);
// details are submitted to creatGroup function from groupProvider
this.messageService.createGroup(this.groupDetails).then(resp => {
console.log(resp);
this.toast.show("Group Created");
this.router.navigate(["/home"]);
});
}
createGroup(groupDetails) {
return this.angularFirestore.collection('Groups').add(groupDetails);
}