Closed
Description
A major pain point with angularfire continues to be mapping a document ID to a collection query. I propose we add an optional withId
argument to collection.valueChanges()
. This can be a simple non-breaking change and I can PR it.
collection.valueChanges(withId?: string)
// emits [ { myIdKey: 'MrfFpRBfWLTd7LqiTt9u', ...data }, ... ]
This will greatly simplify the code below
// current requirement
ref.snapshotChanges()
.pipe(
map(actions => {
return actions.map(a => {
const data = a.payload.doc.data();
const id = a.payload.doc.id;
return { myIdKey: id, ...data };
});
})
// after change
ref.valueChanges('myIDKey')
Metadata
Metadata
Assignees
Labels
No labels