Skip to content
This repository has been archived by the owner on Apr 15, 2023. It is now read-only.

fix: Remove deletion of __v when creating history doc #62

Merged
merged 1 commit into from
Nov 2, 2020

Conversation

kirkeaton
Copy link
Contributor

Setting __v to undefined causes the main document to be saved with a version key of null in some cases.

This fix addresses the following issues:
#58
#45

@@ -113,12 +113,12 @@ module.exports = function historyPlugin(schema, options) {
});

function createHistoryDoc(d, operation) {
d.__v = undefined;
const { __v, ...doc } = d;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of setting __v to undefined I'm using the object spread operator to copy all of the other fields into a variable called doc which I'm then setting on the history document.

@nassor nassor merged commit 1940e59 into nassor:master Nov 2, 2020
@kirkeaton kirkeaton deleted the bug/__v branch November 15, 2020 17:56
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants