Skip to content

Commit

Permalink
fix(update): dont double-call setters on arrays
Browse files Browse the repository at this point in the history
Fix #5041
  • Loading branch information
vkarpov15 committed Mar 15, 2017
1 parent 9105d85 commit 0a88085
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions lib/services/query/castUpdate.js
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,7 @@ function castUpdateVal(schema, val, op, $conditional) {
} else {
val = tmp;
}
return val;
}

if (op in numberOps) {
Expand Down
2 changes: 1 addition & 1 deletion test/model.update.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2440,7 +2440,7 @@ describe('model: update:', function() {

var User = db.model('gh5041', UserSchema);

User.findOneAndUpdate({}, { foos: [ {foo: '13.57'} ] }, function(error) {
User.findOneAndUpdate({}, { foos: [{ foo: '13.57' }] }, function(error) {
assert.ifError(error);
assert.equal(called, 1);
done();
Expand Down

0 comments on commit 0a88085

Please sign in to comment.