From 5f630aa52ac5c7309d96ec9ad021200e4051dcd9 Mon Sep 17 00:00:00 2001
From: Shelley Cincotta <48364688+shelcindra@users.noreply.github.com>
Date: Fri, 24 Jan 2020 13:17:27 -0500
Subject: [PATCH] Added docData function to documentation.
---
packages/rxfire/docs/firestore.md | 29 +++++++++++++++++++++++++++++
1 file changed, 29 insertions(+)
diff --git a/packages/rxfire/docs/firestore.md b/packages/rxfire/docs/firestore.md
index 5ffdf53e701..5e942be4e83 100644
--- a/packages/rxfire/docs/firestore.md
+++ b/packages/rxfire/docs/firestore.md
@@ -33,6 +33,35 @@ doc(davidDoc).subscribe(snapshot => {
});
```
+### `docData()`
+The `docData()` function returns a stream of a document, mapped to its data payload and optionally the document ID.
+
+| | |
+|-----------------|------------------------------------------|
+| **function** | `docData()` |
+| **params** | ref: `firestore.DocumentReference`
idField?: `string` |
+| **import path** | `rxfire/firestore` |
+| **return** | `Observable` |
+
+#### TypeScript Example
+```ts
+import { docData } from 'rxfire/firestore';
+import { firestore, initializeApp } from 'firebase';
+import 'firebase/firestore';
+
+// Set up Firebase
+const app = initializeApp({ /* config */ });
+const db = app.firestore();
+const davidDocRef = db.doc('users/david');
+
+// Seed the firestore
+davidDocRef.set({ name: 'David' });
+
+docData(davidDocRef,'uid').subscribe(userData => {
+ console.log(`${userData.name} has id ${userData.uid}`);
+});
+```
+
## Collection Observables
### `collection()`