File tree 1 file changed +29
-0
lines changed 1 file changed +29
-0
lines changed Original file line number Diff line number Diff line change @@ -33,6 +33,35 @@ doc(davidDoc).subscribe(snapshot => {
33
33
});
34
34
```
35
35
36
+ ### ` docData() `
37
+ The ` docData() ` function returns a stream of a document, mapped to its data payload and optionally the document ID.
38
+
39
+ | | |
40
+ | -----------------| ------------------------------------------|
41
+ | ** function** | ` docData() ` |
42
+ | ** params** | ref: ` firestore.DocumentReference ` <br > idField?: ` string ` |
43
+ | ** import path** | ` rxfire/firestore ` |
44
+ | ** return** | ` Observable<T> ` |
45
+
46
+ #### TypeScript Example
47
+ ``` ts
48
+ import { docData } from ' rxfire/firestore' ;
49
+ import { firestore , initializeApp } from ' firebase' ;
50
+ import ' firebase/firestore' ;
51
+
52
+ // Set up Firebase
53
+ const app = initializeApp ({ /* config */ });
54
+ const db = app .firestore ();
55
+ const davidDocRef = db .doc (' users/david' );
56
+
57
+ // Seed the firestore
58
+ davidDocRef .set ({ name: ' David' });
59
+
60
+ docData (davidDocRef ,' uid' ).subscribe (userData => {
61
+ console .log (` ${userData .name } has id ${userData .uid } ` );
62
+ });
63
+ ```
64
+
36
65
## Collection Observables
37
66
38
67
### ` collection() `
You can’t perform that action at this time.
0 commit comments