diff --git a/src/database/mongo/hash.js b/src/database/mongo/hash.js index 800bd6525c..da1d2483d9 100644 --- a/src/database/mongo/hash.js +++ b/src/database/mongo/hash.js @@ -208,12 +208,15 @@ module.exports = function(db, module) { if (!key || !Array.isArray(fields) || !fields.length) { return callback(); } + fields = fields.filter(Boolean); + if (!fields.length) { + return callback(); + } + var data = {}; fields.forEach(function(field) { - if (field) { - field = helpers.fieldToString(field); - data[field] = ''; - } + field = helpers.fieldToString(field); + data[field] = ''; }); db.collection('objects').update({_key: key}, {$unset : data}, function(err, res) {