(documentRef: DocumentReference, data: DocumentData, options?: SetOptions)
| 1165 | } |
| 1166 | |
| 1167 | set(documentRef: DocumentReference, data: DocumentData, options?: SetOptions): WriteBatch { |
| 1168 | if (options) { |
| 1169 | if (typeof options?.merge === 'boolean') { |
| 1170 | return WriteBatch.fromNative(this.native.setDataForDocumentMerge(serializeItems(data), documentRef.native, options.merge)); |
| 1171 | } |
| 1172 | |
| 1173 | if (options.mergeFields) { |
| 1174 | if (Array.isArray(options.mergeFields)) { |
| 1175 | if (typeof options.mergeFields[0] === 'string') { |
| 1176 | return WriteBatch.fromNative(this.native.setDataForDocumentMergeFields(serializeItems(data), documentRef.native, options.mergeFields)); |
| 1177 | } |
| 1178 | |
| 1179 | return WriteBatch.fromNative( |
| 1180 | this.native.setDataForDocumentMergeFields( |
| 1181 | serializeItems(data), |
| 1182 | documentRef.native, |
| 1183 | options.mergeFields.map((field) => field.native) |
| 1184 | ) |
| 1185 | ); |
| 1186 | } |
| 1187 | } |
| 1188 | |
| 1189 | return null; |
| 1190 | } else { |
| 1191 | return WriteBatch.fromNative(this.native.setDataForDocument(serializeItems(data), documentRef.native)); |
| 1192 | } |
| 1193 | } |
| 1194 | |
| 1195 | update<T extends DocumentData = DocumentData>(documentRef: DocumentReference<T>, data: Partial<{ [K in keyof T]: T[K] | FieldValue }>): WriteBatch; |
| 1196 | update<T extends DocumentData = DocumentData, K extends keyof T = string>(documentRef: DocumentReference<T>, field: K | FieldPath, value: FieldValue | T[K], moreFieldAndValues: any[]): WriteBatch; |
nothing calls this directly
no test coverage detected