The firestoreMerge
function is a higher-order function that returns a function specifically designed for merging updates into a document in a collection.
firestoreMerge
function allows for merging updates to a document within a Firestore collection. The primary use case is to update fields in a document without overwriting the entire document. This is especially useful for partial updates.
Usage is straightforward:
firestoreMerge
can also handle subcollections. To update a document in a subcollection, the collection path must include the subcollection path:
firestoreMerge
function returns a Promise that resolves to a DocumentReference
of the merged document:
addMetadata
option.