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; }