diff --git a/package.json b/package.json index 852252b..e627590 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "mongoose-subscriptions-braintree", - "version": "1.6.0", + "version": "1.6.1", "description": "Braintree processor for mongoose-subscriptions", "main": "src/index.js", "repository": "git@github.com:enhancv/mongoose-subscriptions-braintree.git", diff --git a/src/index.js b/src/index.js index 8a8cbf7..a6e099e 100644 --- a/src/index.js +++ b/src/index.js @@ -14,12 +14,20 @@ function isChanged(item) { function saveCollection(name, saveItem, customer) { return some(isChanged, customer[name]) - ? Promise.all(customer[name].map(saveItem(customer))).then(() => customer.save()) + ? Promise.all(customer[name].map(saveItem(customer))).then(() => { + delete customer.__v; + customer.save(); + }) : Promise.resolve(); } function saveCustomer(saveItem, customer) { - return isChanged(customer) ? saveItem(customer).then(() => customer.save()) : Promise.resolve(); + return isChanged(customer) + ? saveItem(customer).then(() => { + delete customer.__v; + customer.save(); + }) + : Promise.resolve(); } class BraintreeProcessor extends AbstractProcessor {