We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent f1014ee commit d0d0729Copy full SHA for d0d0729
src/firestore/collection/collection.ts
@@ -113,6 +113,21 @@ export class AngularFirestoreCollection<T=DocumentData> {
113
);
114
}
115
116
+ /**
117
+ * Listen to all documents in the collection and its possible query as an Observable.
118
+ */
119
+ keyValueChanges(): Observable<{[key:string]: T}> {
120
+ const fromCollectionRef$ = fromCollectionRef<T>(this.query);
121
+ const scheduled$ = this.afs.scheduler.runOutsideAngular(fromCollectionRef$);
122
+ return this.afs.scheduler.keepUnstableUntilFirst(scheduled$)
123
+ .pipe(
124
+ map(actions => actions.payload.docs.reduce((versions, action) => {
125
+ versions[action.id] = action.data();
126
+ return versions;
127
+ }, {}))
128
+ );
129
+ }
130
+
131
/**
132
* Add data to a collection reference.
133
*
0 commit comments