diff --git a/src/Meteor.js b/src/Meteor.js index 30972ed..20be280 100644 --- a/src/Meteor.js +++ b/src/Meteor.js @@ -153,10 +153,18 @@ module.exports = { }); Data.ddp.on('changed', message => { + const unset = {}; + if (message.cleared) { + message.cleared.forEach(field => { + unset[field] = null; + }); + } + Data.db[message.collection] && Data.db[message.collection].upsert({ _id: message.id, ...message.fields, + ...unset, }); });