Skip to content

Commit

Permalink
refactor: Rename update method to updatePartial in DocumentReference
Browse files Browse the repository at this point in the history
The `update` method in the `DocumentReference` class has been renamed to `updatePartial` to better reflect its purpose. This change improves the clarity and readability of the code.

BREAKING CHANGE: The `update` method in the `DocumentReference` not available anymore. use `updatePartial` instead.

Co-authored-by: Mohammad Honarvar <[email protected]>
  • Loading branch information
alimd and mohammadhonarvar committed Aug 31, 2024
1 parent 5467a66 commit c16d164
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions packages/reference/src/document-reference.ts
Original file line number Diff line number Diff line change
Expand Up @@ -285,18 +285,17 @@ export class DocumentReference<TDoc extends JsonifiableObject = JsonifiableObjec
}

/**
* Update Document's data.
* Can be used to update a part of the document.
* Updates document's data by merging a partial update into the document's data.
*
* @param data Data to update the document with.
* @param data The part of data to merge into the document's data.
*
* @example
* ```typescript
* documentRef.update({ key: 'updated value' });
* documentRef.updatePartial({ c: 4 });
* ```
*/
update(data: Partial<TDoc>): void {
this.logger__.logMethodArgs?.('update', data);
updatePartial(data: Partial<TDoc>): void {
this.logger__.logMethodArgs?.('updatePartial', data);
Object.assign(this.context__.data, data);
this.updated__();
}
Expand Down

0 comments on commit c16d164

Please sign in to comment.