I have a array of references retrieved from angularfire
this.userIds$ = this.users$.switchMap(email =>
db.list('/USERS/', ref => {
let temp = email ? ref.orderByChild('EMAIL').startAt(email).endAt(email + "\uf8ff") : ref
console.log('carrot');
return temp;
}
).snapshotChanges()
);
I am trying to return this data as one observable, but although I can see the path populating the correct database references, when is all said and done my configs array just contains a couple of thousand 'undefined' entries what am I doing wrong? I have tried various things but the result is always the same, so ive condensed the problem down into the below and hoping for some help
//Subscribe to the output of user ids, when we get a hit (delivered as an array of Observable DataSnapshot) loop through and subscribe to all the children of this location
this.userConfigs$ = this.userIds$.pipe(
switchMap(itemIds => {
let configs = itemIds.map(itemId => {
let pathOrRef = '/AIS/USERSAVEDCONFIGS/' + itemId.key;
console.log('tomato');
db.list(pathOrRef).snapshotChanges(['child_added']);
});
return configs;
})
);
and I kick the whole thing off with
this.userConfigs$.subscribe();