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

Method set

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

Source from the content-addressed store, hash-verified

205 }
206
207 set<T extends DocumentData = DocumentData>(documentRef: DocumentReference<T>, data: T, options?: SetOptions): Transaction {
208 let transaction;
209 if (options) {
210 if (typeof options?.merge === 'boolean') {
211 transaction = this.native.setDataForDocumentMerge(serializeItems(data), documentRef.native, options.merge);
212 } else if (options.mergeFields) {
213 if (Array.isArray(options.mergeFields)) {
214 if (typeof options.mergeFields[0] === 'string') {
215 transaction = this.native.setDataForDocumentMergeFields(serializeItems(data), documentRef.native, options.mergeFields);
216 } else {
217 transaction = this.native.setDataForDocumentMergeFields(
218 serializeItems(data),
219 documentRef.native,
220 options.mergeFields.map((field) => field.native)
221 );
222 }
223 }
224 }
225 } else {
226 transaction = this.native.setDataForDocument(serializeItems(data), documentRef.native);
227 }
228 return Transaction.fromNative(transaction);
229 }
230
231 get ios() {
232 return this.native;

Callers

nothing calls this directly

Calls 2

serializeItemsFunction · 0.70
fromNativeMethod · 0.45

Tested by

no test coverage detected