Closed
Description
Easier access to a document’s ID
Getting the id
mapped to a single document has also long been a pain point, so we thinking of introducing a new operator to simplify this process:
Collection
// using the new docs property in issue #1819
const items$ = af.collection(‘items’).docs
.pipe(
unwrapCollection({ id: ‘key’ })
)
.subscribe(items => {
const first = docs[0];
console.log(first.key); // they id is mapped to each object!
});
Document
// using the .doc property in issue #1819
const items$ = af.collection(‘items/1’).doc
.pipe(
unwrapDoc({ id: ‘key’ })
)
.subscribe(item => {
console.log(item.key);
});
Leave a comment letting us know what you think.
Metadata
Metadata
Assignees
Labels
No labels