在Google Cloud Firebase中插入新文档后,是否可以返回文档ID?
这是到目前为止我的保存方法的一个示例:
save(entity:any){
entity = JSON.parse(JSON.stringify(entity));
if(entity.id){
return db.collection(this.collectionName).doc(entity.id).update(entity);
}else{
// How to return the newly created document id from here?
return db.collection(this.collectionName).doc().set(entity);
}
}
编辑:这是我要引用的有价文件ID的突出显示示例