你能告诉我如何在 budgets
集合中查询 budgetGroup
对象的 id
吗?
我可以像下面这样做一个基本的查询 . 但是如何查询上面提到的内部对象呢?
provider.ts
getSpecificBudget(id:string;budgetGroup: BudgetGroup, projectId: string): AngularFirestoreCollection<Budget> {
return this.fireStore.collection<Budget>(`projects/${projectId}/budgets`, ref => ref
.where('id', '==', id)
);
}
model.ts
export class Budget {
id: string;
amount: number;
contingency: number = 20;
budgetGroup: BudgetGroup = new BudgetGroup();
creationTime: string;
}
export class BudgetGroup {
id: string;
name: string;
creationTime: string;
}
公司的FireStore:
1 回答
这是解决方案 . 我们可以简单地如下所示 . 即
.where('budgetGroup.id', '==', budgetGroup.id)