diff --git a/lib/collection.js b/lib/collection.js index 01df1b278..19d26d6c1 100644 --- a/lib/collection.js +++ b/lib/collection.js @@ -220,7 +220,7 @@ Collection.prototype.update = function update(criteria, values, cb) { // Lookup records being updated and grab their ID's // Useful for later looking up the record after an insert // Required because options may not contain an ID - collection.find(query.criteria.where).toArray(function(err, records) { + collection.find(query.criteria.where, {_id: 1}).toArray(function(err, records) { if(err) return cb(err); if(!records) return cb(Errors.NotFound); diff --git a/test/unit/query/adapter.query.test.js b/test/unit/query/adapter.query.test.js index b911f155a..bae9fe20b 100644 --- a/test/unit/query/adapter.query.test.js +++ b/test/unit/query/adapter.query.test.js @@ -233,7 +233,7 @@ describe('Query', function () { var where = { or: [{ name: { $exists: false } }, { name: { '!': 'clark' } }] }; - var expect = { $or: [ { name: { $exists: false } }, { name: { $ne: /^clark$/i } } ] }; + var expect = { $or: [ { name: { $exists: false } }, { name: { $ne: 'clark' } } ] }; var Q = new Query({ where: where }, { name: 'string', age: 'integer' }); var actual = Q.criteria.where; assert(_.isEqual(actual, expect)); @@ -241,4 +241,4 @@ describe('Query', function () { }); -}); \ No newline at end of file +});