From afc6756db9cc0c3032ea09c25161931676cd1349 Mon Sep 17 00:00:00 2001 From: Kirk Eaton Date: Wed, 14 Oct 2020 13:37:48 -0400 Subject: [PATCH] fix: Remove deletion of __v when creating history doc --- lib/mongoose-history.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/mongoose-history.js b/lib/mongoose-history.js index af799aa..7bde2a1 100644 --- a/lib/mongoose-history.js +++ b/lib/mongoose-history.js @@ -113,12 +113,12 @@ module.exports = function historyPlugin(schema, options) { }); function createHistoryDoc(d, operation) { - d.__v = undefined; + const { __v, ...doc } = d; let historyDoc = {}; historyDoc['t'] = new Date(); historyDoc['o'] = operation; - historyDoc['d'] = d; + historyDoc['d'] = doc; return historyDoc; }