diff options
author | Jonathan Abrahams <jonathan@mongodb.com> | 2016-03-09 12:17:50 -0500 |
---|---|---|
committer | Jonathan Abrahams <jonathan@mongodb.com> | 2016-03-09 12:18:14 -0500 |
commit | 4ae691e8edc87d0e3cfb633bb91c328426be007b (patch) | |
tree | 52079a593f54382ca13a2e741633eab1b6271893 /jstests/core/where4.js | |
parent | a025d43f3ce2efc1fb1282a718f5d286fa0a4dc1 (diff) | |
download | mongo-4ae691e8edc87d0e3cfb633bb91c328426be007b.tar.gz |
SERVER-22468 Format JS code with approved style in jstests/
Diffstat (limited to 'jstests/core/where4.js')
-rw-r--r-- | jstests/core/where4.js | 40 |
1 files changed, 25 insertions, 15 deletions
diff --git a/jstests/core/where4.js b/jstests/core/where4.js index 685665c982a..28d621374c3 100644 --- a/jstests/core/where4.js +++ b/jstests/core/where4.js @@ -1,27 +1,37 @@ db.where4.drop(); -db.system.js.insert( { _id : "w4" , value : "5" } ); +db.system.js.insert({_id: "w4", value: "5"}); -db.where4.insert( { x : 1 , y : 1 } ); -db.where4.insert( { x : 2 , y : 1 } ); +db.where4.insert({x: 1, y: 1}); +db.where4.insert({x: 2, y: 1}); -db.where4.update( { $where : function() { return this.x == 1; } } , - { $inc : { y : 1 } } , false , true ); +db.where4.update( + { + $where: function() { + return this.x == 1; + } + }, + {$inc: {y: 1}}, + false, + true); - -assert.eq( 2 , db.where4.findOne( { x : 1 } ).y ); -assert.eq( 1 , db.where4.findOne( { x : 2 } ).y ); +assert.eq(2, db.where4.findOne({x: 1}).y); +assert.eq(1, db.where4.findOne({x: 2}).y); // Test that where queries work with stored javascript -db.system.js.save( { _id : "where4_addOne" , value : function(x) { return x + 1; } } ); +db.system.js.save({ + _id: "where4_addOne", + value: function(x) { + return x + 1; + } +}); -db.where4.update( { $where : "where4_addOne(this.x) == 2" } , - { $inc : { y : 1 } } , false , true ); +db.where4.update({$where: "where4_addOne(this.x) == 2"}, {$inc: {y: 1}}, false, true); -assert.eq( 3 , db.where4.findOne( { x : 1 } ).y ); -assert.eq( 1 , db.where4.findOne( { x : 2 } ).y ); +assert.eq(3, db.where4.findOne({x: 1}).y); +assert.eq(1, db.where4.findOne({x: 2}).y); -db.system.js.remove( { _id : "where4_equalsOne" } ); +db.system.js.remove({_id: "where4_equalsOne"}); -db.system.js.remove( { _id : "w4" } ); +db.system.js.remove({_id: "w4"}); |