Skip to content

Commit

Permalink
Fix assumption that nested field has a class
Browse files Browse the repository at this point in the history
  • Loading branch information
lukejagodzinski committed Oct 26, 2015
1 parent 6269c4f commit bf6e239
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions lib/modules/fields/pull.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,9 @@ proto._pullOne = function(fieldName, pullValue, options) {

// Check if a value is present in an array.
if (!_.find(nestedDoc[nestedFieldName], function(value) {
value = field.plain(value);
if (field) {
value = field.plain(value);
}
return EJSON.equals(value, pullValue);
})) {
return;
Expand Down Expand Up @@ -132,7 +134,9 @@ proto._pullOne = function(fieldName, pullValue, options) {
nestedDoc[nestedFieldName] = _.filter(
nestedDoc[nestedFieldName],
function(value) {
value = field.plain(value);
if (field) {
value = field.plain(value);
}
return !EJSON.equals(value, pullValue);
}
);
Expand Down

0 comments on commit bf6e239

Please sign in to comment.