diff --git a/lib/mongodb/commands/update_command.js b/lib/mongodb/commands/update_command.js index 090200b1885..daa3cba48c0 100644 --- a/lib/mongodb/commands/update_command.js +++ b/lib/mongodb/commands/update_command.js @@ -32,7 +32,7 @@ var UpdateCommand = exports.UpdateCommand = function(db, collectionName, spec, d this.document = document; this.db = db; this.serializeFunctions = false; - this.checkKeys = typeof options.checkKeys != 'boolean' ? true : options.checkKeys; + this.checkKeys = typeof options.checkKeys != 'boolean' ? false : options.checkKeys; // Generate correct flags var db_upsert = 0; diff --git a/package.json b/package.json index a1726b74777..6afcd44b16e 100755 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name" : "mongodb" , "description" : "A node.js driver for MongoDB" , "keywords" : ["mongodb", "mongo", "driver", "db"] -, "version" : "1.3.13" +, "version" : "1.3.14" , "author" : "Christian Amor Kvalheim " , "contributors" : [ "Aaron Heckmann", "Christoph Pojer", diff --git a/test/tests/functional/insert_tests.js b/test/tests/functional/insert_tests.js index f080b15d283..9a8204b54b5 100644 --- a/test/tests/functional/insert_tests.js +++ b/test/tests/functional/insert_tests.js @@ -1695,7 +1695,7 @@ exports.shouldCorrectlyOverrideCheckKeysNativeOnUpdate = function(configuration, db.open(function(err, db) { db.collection('shouldCorrectlyOverrideCheckKeysNativeOnUpdate').update({ ps: {op: {'$set': 1}} - }, {'$set': {b: 1}}, function(err, doc) { + }, {'$set': {b: 1}}, {checkKeys:true}, function(err, doc) { test.ok(err != null); db.collection('shouldCorrectlyOverrideCheckKeysNativeOnUpdate').update({ @@ -1716,7 +1716,7 @@ exports.shouldCorrectlyOverrideCheckKeysJSOnUpdate = function(configuration, tes db.open(function(err, db) { db.collection('shouldCorrectlyOverrideCheckKeysJSOnUpdate').update({ ps: {op: {'$set': 1}} - }, {'$set': {b: 1}}, function(err, doc) { + }, {'$set': {b: 1}}, {checkKeys:true}, function(err, doc) { test.ok(err != null); db.collection('shouldCorrectlyOverrideCheckKeysJSOnUpdate').update({ @@ -1729,3 +1729,18 @@ exports.shouldCorrectlyOverrideCheckKeysJSOnUpdate = function(configuration, tes }); }); } + +exports.shouldCorrectlyWorkWithCheckKeys = function(configuration, test) { + var Long = configuration.getMongoPackage().Long; + + var db = configuration.newDbInstance({w:1}, {native_parser:false}) + db.open(function(err, db) { + db.collection('shouldCorrectlyOverrideCheckKeysJSOnUpdate').update({ + "ps.op.t":1 + }, {'$set': {b: 1}}, function(err, doc) { + test.equal(null, err); + db.close(); + test.done(); + }); + }); +}