MCPcopy Create free account
hub / github.com/NativeScript/firebase / set

Method set

packages/firebase-firestore/index.android.ts:1308–1330  ·  view source on GitHub ↗
(documentRef: DocumentReference, data: DocumentData, options?: SetOptions)

Source from the content-addressed store, hash-verified

1306 }
1307
1308 set(documentRef: DocumentReference, data: DocumentData, options?: SetOptions): WriteBatch {
1309 if (options) {
1310 if (typeof options?.merge === 'boolean') {
1311 const opts = com.google.firebase.firestore.SetOptions.merge();
1312 return WriteBatch.fromNative(this.native.set(documentRef.native, serializeItems(data), opts));
1313 }
1314
1315 if (options.mergeFields) {
1316 if (Array.isArray(options.mergeFields)) {
1317 if (typeof options.mergeFields[0] === 'string') {
1318 return WriteBatch.fromNative(this.native.set(documentRef.native, serializeItems(data), com.google.firebase.firestore.SetOptions.mergeFields(options.mergeFields as any)));
1319 }
1320
1321 const list = java.util.Arrays.asList(options.mergeFields.map((field) => field.native));
1322 return WriteBatch.fromNative(this.native.set(documentRef.native, serializeItems(data), com.google.firebase.firestore.SetOptions.mergeFields(list)));
1323 }
1324 }
1325
1326 return null;
1327 } else {
1328 return WriteBatch.fromNative(this.native.set(documentRef.native, serializeItems(data)));
1329 }
1330 }
1331
1332 get native() {
1333 return this._native;

Callers

nothing calls this directly

Calls 3

serializeItemsFunction · 0.70
setMethod · 0.65
fromNativeMethod · 0.45

Tested by

no test coverage detected