How to query firebase database to return an angularfirelist from an array of ids

I have an object that has a property whose value is a list of ids.

const obj = { list: ['id-1', 'id-2', 'id-3'] };

Currently, this is all I'm able to do. But it returns an array of Observables.

// Class variable...
records: Observable<Record>[];

constructor(private afDB: AngularFireDatabase) {}

getRecords () {
  this.records = => this.afDB.object(`path/to/collection/${id}`));

Having this.records as an array of Observable's does not seem the best for use in the template, unlike an Observable of an array.

I would rather have records: Observable<Record[]> than records: Observable<Record>[].

Is there anyway to pass those id's along as part of the query function to angularfire database instead?

1 answer