Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
style: fix lint
  • Loading branch information
vkarpov15 committed Jul 1, 2024
commit 91acf6f183866f033e4d1aeae30549f69a215d66
20 changes: 10 additions & 10 deletions lib/document.js
Original file line number Diff line number Diff line change
Expand Up @@ -5189,9 +5189,9 @@ Document.prototype.$clone = function() {
/**
* Creates a snapshot of this document's internal change tracking state. You can later
* reset this document's change tracking state using `$restoreModifiedPathsSnapshot()`.
*
*
* #### Example:
*
*
* const doc = await TestModel.findOne();
* const snapshot = doc.$createModifiedPathsSnapshot();
*
Expand Down Expand Up @@ -5222,14 +5222,14 @@ Document.prototype.$createModifiedPathsSnapshot = function $createModifiedPathsS
* Restore this document's change tracking state to the given snapshot.
* Note that `$restoreModifiedPathsSnapshot()` does **not** modify the document's
* properties, just resets the change tracking state.
*
*
* This method is especially useful when writing [custom transaction wrappers](https://github.com/Automattic/mongoose/issues/14268#issuecomment-2100505554) that need to restore change tracking when aborting a transaction.
*
*
* #### Example:
*
*
* const doc = await TestModel.findOne();
* const snapshot = doc.$createModifiedPathsSnapshot();
*
*
* doc.name = 'test';
* doc.$restoreModifiedPathsSnapshot(snapshot);
* doc.$isModified('name'); // false because `name` was not modified when snapshot was taken
Expand Down Expand Up @@ -5260,14 +5260,14 @@ Document.prototype.$restoreModifiedPathsSnapshot = function $restoreModifiedPath

/**
* Clear the document's modified paths.
*
*
* #### Example:
*
*
* const doc = await TestModel.findOne();
*
*
* doc.name = 'test';
* doc.$isModified('name'); // true
*
*
* doc.$clearModifiedPaths();
* doc.name; // 'test', `$clearModifiedPaths()` does **not** modify the document's data, only change tracking
*
Expand Down
2 changes: 1 addition & 1 deletion lib/modifiedPathsSnapshot.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ module.exports = class ModifiedPathsSnapshot {
this.activePaths = activePaths;
this.version = version;
}
}
};