Skip to content

Commit

Permalink
Merge pull request #76 from azurechen/patch-1
Browse files Browse the repository at this point in the history
Support setDoc with merge options
  • Loading branch information
codediodeio authored Nov 6, 2019
2 parents e49e5ff + e44437d commit a1d2859
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/collection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@ export interface GeoQueryOptions {
}
const defaultOpts: GeoQueryOptions = { units: 'km' };

export interface SetOptions {
merge?: boolean;
mergeFields?: (string | FieldPath)[];
}

export interface QueryMetadata {
bearing: number;
distance: number;
Expand Down Expand Up @@ -71,10 +76,11 @@ export class GeoFireCollectionRef<T> {
* Create or update a document in the collection based on the document ID
* @param {string} id
* @param {any} data
* @param {SetOptions} options
* @returns {Promise<void>}
*/
setDoc(id: string, data: any) {
return this.ref.doc(id).set(data);
setDoc(id: string, data: any, options?: SetOptions) {
return this.ref.doc(id).set(data, options);
}
/**
* Create or update a document in the collection based on the document ID merging fields
Expand Down

0 comments on commit a1d2859

Please sign in to comment.