我创建城市文档,并在其中保存一些字段,例如标题和说明。以后是否可以通过知道该db.collection路径的城市名称而不是ID来向特定城市添加一些字段?
添加了第一个元素
public createSavedCity(title: string,desc: string): void {
const cityFields = {
title: title,description: desc
}
this.db.collection('saved').add(savedFields);}
我将使用新功能来更新文档,该文档将接收要更新的文档标题作为参数
updateDoc(savedTitle: string,newItem: string) : void {
this.db.collection.(`saved/${savedTitle}`).update({newField: newItem});
}