diff --git a/lib/prune.js b/lib/prune.js index 15b1cc8..899ff2f 100644 --- a/lib/prune.js +++ b/lib/prune.js @@ -9,7 +9,7 @@ function prune(doc, model, type) { for (var prop in doc) { - if (!prop || doc[prop] === undefined) + if (!type || !prop || doc[prop] === undefined) continue; var propDef = type[prop]; @@ -53,4 +53,4 @@ module.exports = function(model, collection, docs) { for (var i in docs) { prune(docs, model, entityType); } -}; \ No newline at end of file +};