diff options
author | Scott Hernandez <scotthernandez@gmail.com> | 2014-02-18 13:54:49 -0500 |
---|---|---|
committer | Scott Hernandez <scotthernandez@gmail.com> | 2014-02-18 17:17:59 -0500 |
commit | 3042939e0f64bbb9076eef3ee1efcdd56fc02050 (patch) | |
tree | c7c16daaecb59dce34707352b7d77284a41706e8 /jstests | |
parent | 3a08be3bf2a1a650c97543a448a8ea0c143a89b6 (diff) | |
download | mongo-3042939e0f64bbb9076eef3ee1efcdd56fc02050.tar.gz |
SERVER-12625: skip oplog entries for no-op fields
Diffstat (limited to 'jstests')
-rw-r--r-- | jstests/update_min_max_examples.js | 30 |
1 files changed, 13 insertions, 17 deletions
diff --git a/jstests/update_min_max_examples.js b/jstests/update_min_max_examples.js index 5dd322f96f3..ef84cff3635 100644 --- a/jstests/update_min_max_examples.js +++ b/jstests/update_min_max_examples.js @@ -3,33 +3,29 @@ var coll = db.update_min_max; coll.drop(); // $min for number -coll.remove({}) -coll.save({_id:1, a:2}); -coll.update({}, {$min: {a: 1}}) +coll.insert({_id:1, a:2}); +coll.update({_id:1}, {$min: {a: 1}}) assert.gleSuccess(coll.getDB()) -assert.eq(coll.findOne().a, 1) +assert.eq(coll.findOne({_id:1}).a, 1) // $max for number -coll.remove({}) -coll.save({_id:1, a:2}); -coll.update({}, {$max: {a: 1}}) +coll.insert({_id:2, a:2}); +coll.update({_id:2}, {$max: {a: 1}}) assert.gleSuccess(coll.getDB()) -assert.eq(coll.findOne().a, 2) +assert.eq(coll.findOne({_id:2}).a, 2) // $min for Date -coll.remove({}) -coll.save({_id:1, a: new Date()}); -var origDoc = coll.findOne() +coll.insert({_id:3, a: new Date()}); +var origDoc = coll.findOne({_id:3}) sleep(2) -coll.update({}, {$min: {a: new Date()}}) +coll.update({_id:3}, {$min: {a: new Date()}}) assert.gleSuccess(coll.getDB()) -assert.eq(coll.findOne().a, origDoc.a) +assert.eq(coll.findOne({_id:3}).a, origDoc.a) // $max for Date -coll.remove({}) -coll.save({_id:1, a: new Date()}); +coll.insert({_id:4, a: new Date()}); sleep(2) var newDate = new Date(); -coll.update({}, {$max: {a: newDate}}) +coll.update({_id:4}, {$max: {a: newDate}}) assert.gleSuccess(coll.getDB()) -assert.eq(coll.findOne().a, newDate) +assert.eq(coll.findOne({_id:4}).a, newDate) |