Skip to content

Commit a1d2859

Browse files
authored
Merge pull request #76 from azurechen/patch-1
Support setDoc with merge options
2 parents e49e5ff + e44437d commit a1d2859

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

src/collection.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,11 @@ export interface GeoQueryOptions {
1313
}
1414
const defaultOpts: GeoQueryOptions = { units: 'km' };
1515

16+
export interface SetOptions {
17+
merge?: boolean;
18+
mergeFields?: (string | FieldPath)[];
19+
}
20+
1621
export interface QueryMetadata {
1722
bearing: number;
1823
distance: number;
@@ -71,10 +76,11 @@ export class GeoFireCollectionRef<T> {
7176
* Create or update a document in the collection based on the document ID
7277
* @param {string} id
7378
* @param {any} data
79+
* @param {SetOptions} options
7480
* @returns {Promise<void>}
7581
*/
76-
setDoc(id: string, data: any) {
77-
return this.ref.doc(id).set(data);
82+
setDoc(id: string, data: any, options?: SetOptions) {
83+
return this.ref.doc(id).set(data, options);
7884
}
7985
/**
8086
* Create or update a document in the collection based on the document ID merging fields

0 commit comments

Comments
 (0)