diff options
Diffstat (limited to 'jstests/decimal/decimal_update.js')
-rw-r--r-- | jstests/decimal/decimal_update.js | 60 |
1 files changed, 30 insertions, 30 deletions
diff --git a/jstests/decimal/decimal_update.js b/jstests/decimal/decimal_update.js index 6be2bd9e3e6..f50994ce32b 100644 --- a/jstests/decimal/decimal_update.js +++ b/jstests/decimal/decimal_update.js @@ -1,40 +1,40 @@ // Test decimal updates (function() { - "use strict"; - var col = db.decimal_updates; - col.drop(); +"use strict"; +var col = db.decimal_updates; +col.drop(); - // Insert some sample data. - var docs = [ - {'a': NumberDecimal("1.0")}, - {'a': NumberDecimal("0.0")}, - {'a': NumberDecimal("1.00")}, - {'a': NumberLong("1")}, - {'a': 1} - ]; +// Insert some sample data. +var docs = [ + {'a': NumberDecimal("1.0")}, + {'a': NumberDecimal("0.0")}, + {'a': NumberDecimal("1.00")}, + {'a': NumberLong("1")}, + {'a': 1} +]; - assert.writeOK(col.insert(docs), "Initial insertion failed"); +assert.writeOK(col.insert(docs), "Initial insertion failed"); - assert.writeOK(col.update({}, {$inc: {'a': NumberDecimal("10")}}, {multi: true}), - "update $inc failed"); - assert.eq(col.find({a: 11}).count(), 4, "count after $inc incorrect"); - assert.writeOK(col.update({}, {$inc: {'a': NumberDecimal("0")}}, {multi: true}), - "update $inc 0 failed"); - assert.eq(col.find({a: 11}).count(), 4, "count after $inc 0 incorrect"); +assert.writeOK(col.update({}, {$inc: {'a': NumberDecimal("10")}}, {multi: true}), + "update $inc failed"); +assert.eq(col.find({a: 11}).count(), 4, "count after $inc incorrect"); +assert.writeOK(col.update({}, {$inc: {'a': NumberDecimal("0")}}, {multi: true}), + "update $inc 0 failed"); +assert.eq(col.find({a: 11}).count(), 4, "count after $inc 0 incorrect"); - col.drop(); - assert.writeOK(col.insert(docs), "Second insertion failed"); +col.drop(); +assert.writeOK(col.insert(docs), "Second insertion failed"); - assert.writeOK(col.update({}, {$mul: {'a': NumberDecimal("1")}}, {multi: true}), - "update $mul failed"); - assert.eq(col.find({a: 1}).count(), 4, "count after $mul incorrect"); - assert.writeOK(col.update({}, {$mul: {'a': NumberDecimal("2")}}, {multi: true}), - "update $mul 2 failed"); - assert.eq(col.find({a: 2}).count(), 4, "count after $mul incorrect"); - assert.writeOK(col.update({}, {$mul: {'a': NumberDecimal("0")}}, {multi: true}), - "update $mul 0 failed"); - assert.eq(col.find({a: 0}).count(), 5, "count after $mul 0 incorrect"); +assert.writeOK(col.update({}, {$mul: {'a': NumberDecimal("1")}}, {multi: true}), + "update $mul failed"); +assert.eq(col.find({a: 1}).count(), 4, "count after $mul incorrect"); +assert.writeOK(col.update({}, {$mul: {'a': NumberDecimal("2")}}, {multi: true}), + "update $mul 2 failed"); +assert.eq(col.find({a: 2}).count(), 4, "count after $mul incorrect"); +assert.writeOK(col.update({}, {$mul: {'a': NumberDecimal("0")}}, {multi: true}), + "update $mul 0 failed"); +assert.eq(col.find({a: 0}).count(), 5, "count after $mul 0 incorrect"); - assert.writeError(col.update({}, {$bit: {'a': {and: 1}}}, {multi: true}), "$bit should fail"); +assert.writeError(col.update({}, {$bit: {'a': {and: 1}}}, {multi: true}), "$bit should fail"); }()); |