Permalink
Browse files

use $addToSet operator instead of $push

  • Loading branch information...
1 parent f57e241 commit aacfeac76ef317dcc9e9fa96adb52899de842d0b @aheckmann aheckmann committed Oct 18, 2011
Showing with 3 additions and 2 deletions.
  1. +2 −1 lib/types/array.js
  2. +1 −1 test/model.test.js
View
@@ -336,7 +336,8 @@ MongooseArray.prototype.addToSet = function addToSet () {
: ~this.indexOf(v)
if (!found) {
- this.push(v);
+ oldPush.call(this, v);
+ this._registerAtomic('$addToSet', v);
added.push(v);
}
}, this);
View
@@ -1687,7 +1687,7 @@ module.exports = {
, 'mixed': { x: 'ECKS', y: 'why' } // $set
, $pullAll: { 'numbers': [4, 6] }
, $pull: { 'owners': id0 }
- , 'comments.1.body': 8
+ , 'comments.1.body': 8 // $set
}
BlogPost.update({ title: title }, update, function (err) {

0 comments on commit aacfeac

Please sign in to comment.