@@ -15,20 +15,20 @@ import { AngularFirestoreCollection } from '../collection/collection';
1515
1616/**
1717 * AngularFirestoreDocument service
18- *
19- * This class creates a reference to a Firestore Document. A reference is provided in
18+ *
19+ * This class creates a reference to a Firestore Document. A reference is provided in
2020 * in the constructor. The class is generic which gives you type safety for data update
2121 * methods and data streaming.
22- *
22+ *
2323 * This class uses Symbol.observable to transform into Observable using Observable.from().
24- *
24+ *
2525 * This class is rarely used directly and should be created from the AngularFirestore service.
26- *
26+ *
2727 * Example:
28- *
28+ *
2929 * const fakeStock = new AngularFirestoreDocument<Stock>(firebase.firestore.doc('stocks/FAKE'));
3030 * await fakeStock.set({ name: 'FAKE', price: 0.01 });
31- * fakeStock.valueChanges().map(snap => {
31+ * fakeStock.valueChanges().map(snap => {
3232 * if(snap.exists) return snap.data();
3333 * return null;
3434 * }).subscribe(value => console.log(value));
@@ -40,21 +40,22 @@ export class AngularFirestoreDocument<T> {
4040 /**
4141 * The contstuctor takes in a DocumentReference to provide wrapper methods
4242 * for data operations, data streaming, and Symbol.observable.
43- * @param ref
43+ * @param ref
4444 */
4545 constructor ( public ref : firebase . firestore . DocumentReference ) { }
4646
4747 /**
4848 * Create or overwrite a single document.
4949 * @param data
50+ * @param options
5051 */
51- set ( data : T ) : Promise < void > {
52- return this . ref . set ( data ) ;
52+ set ( data : T , options ?: firebase . firestore . SetOptions ) : Promise < void > {
53+ return this . ref . set ( data , options ) ;
5354 }
5455
5556 /**
5657 * Update some fields of a document without overwriting the entire document.
57- * @param data
58+ * @param data
5859 */
5960 update ( data : Partial < T > ) : Promise < void > {
6061 return this . ref . update ( data ) ;
@@ -70,8 +71,8 @@ export class AngularFirestoreDocument<T> {
7071 /**
7172 * Create a reference to a sub-collection given a path and an optional query
7273 * function.
73- * @param path
74- * @param queryFn
74+ * @param path
75+ * @param queryFn
7576 */
7677 collection < T > ( path : string , queryFn ?: QueryFn ) : AngularFirestoreCollection < T > {
7778 const collectionRef = this . ref . collection ( path ) ;
0 commit comments