plans
is a root collection with 2 fields: date
and recipe
. recipe
is a reference to a different root collection called recipes
. I'm trying to construct an observable chain which emits recipes referenced by plans for the specified date range.
lookup(range: MealPlanRange): Observable<Recipe[]> {
return this.db.collection('plans', ref=>ref
.where('date', ">=", range.startDate )
.where('date', "<=", range.endDate )
).valueChanges().pipe(
// at this point, i have the plans i want,
// but i don't know how to get the recipes
switchMap(ps=>(/*how to get observable of recipes?*/)),
);
}
i tried this.db.doc(p[0].recipe)
, but that doesn't return an observable. I looked at creating a query which specified multiple ids, but that doesn't seem possible. Any suggestions?