MCPcopy Index your code
hub / github.com/NativeScript/firebase / set

Method set

packages/firebase-firestore/index.android.ts:261–280  ·  view source on GitHub ↗
(documentRef: DocumentReference<T>, data: T, options?: SetOptions)

Source from the content-addressed store, hash-verified

259 }
260
261 set<T extends DocumentData = DocumentData>(documentRef: DocumentReference<T>, data: T, options?: SetOptions): Transaction {
262 let transaction;
263 if (options) {
264 if (typeof options?.merge === 'boolean') {
265 transaction = this.native.set(serializeItems(data), documentRef.native, com.google.firebase.firestore.SetOptions.merge());
266 } else if (options.mergeFields) {
267 if (Array.isArray(options.mergeFields)) {
268 if (typeof options.mergeFields[0] === 'string') {
269 transaction = this.native.set(serializeItems(data), documentRef.native, com.google.firebase.firestore.SetOptions.mergeFields(options.mergeFields as any));
270 } else {
271 const list = java.util.Arrays.asList(options.mergeFields.map((field) => field.native));
272 transaction = this.native.set(serializeItems(data), documentRef.native, com.google.firebase.firestore.SetOptions.mergeFieldPaths(list));
273 }
274 }
275 }
276 } else {
277 transaction = this.native.set(serializeItems(data), documentRef.native);
278 }
279 return Transaction.fromNative(transaction);
280 }
281
282 get android() {
283 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