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/updatee.js | |
parent | a025d43f3ce2efc1fb1282a718f5d286fa0a4dc1 (diff) | |
download | mongo-4ae691e8edc87d0e3cfb633bb91c328426be007b.tar.gz |
SERVER-22468 Format JS code with approved style in jstests/
Diffstat (limited to 'jstests/core/updatee.js')
-rw-r--r-- | jstests/core/updatee.js | 57 |
1 files changed, 29 insertions, 28 deletions
diff --git a/jstests/core/updatee.js b/jstests/core/updatee.js index 85ba37c5c05..e2fac8af287 100644 --- a/jstests/core/updatee.js +++ b/jstests/core/updatee.js @@ -3,21 +3,22 @@ t = db.updatee; t.drop(); -var o = { "_id" : 1, - "actual" : { - "key1" : "val1", - "key2" : "val2", - "001" : "val3", - "002" : "val4", - "0020000000000000000000" : "val5" - }, - "profile-id" : "test" }; - - -t.insert( o ); -assert.eq( o , t.findOne() , "A1" ); - -t.update({"profile-id" : "test"}, {$set: {"actual.0030000000000000000000": "val6"}}); +var o = { + "_id": 1, + "actual": { + "key1": "val1", + "key2": "val2", + "001": "val3", + "002": "val4", + "0020000000000000000000": "val5" + }, + "profile-id": "test" +}; + +t.insert(o); +assert.eq(o, t.findOne(), "A1"); + +t.update({"profile-id": "test"}, {$set: {"actual.0030000000000000000000": "val6"}}); var q = t.findOne(); @@ -25,47 +26,47 @@ var q = t.findOne(); assert.eq(q.actual["0020000000000000000000"], "val5", "A2"); assert.eq(q.actual["0030000000000000000000"], "val6", "A3"); -t.update({"profile-id" : "test"}, {$set: {"actual.02": "v4"}}); +t.update({"profile-id": "test"}, {$set: {"actual.02": "v4"}}); q = t.findOne(); assert.eq(q.actual["02"], "v4", "A4"); assert.eq(q.actual["002"], "val4", "A5"); -t.update({"_id" : 1}, {$set : {"actual.2139043290148390248219423941.b" : 4}}); +t.update({"_id": 1}, {$set: {"actual.2139043290148390248219423941.b": 4}}); q = t.findOne(); assert.eq(q.actual["2139043290148390248219423941"].b, 4, "A6"); // non-nested -t.update({"_id" : 1}, {$set : {"7213647182934612837492342341" : 1}}); -t.update({"_id" : 1}, {$set : {"7213647182934612837492342342" : 2}}); +t.update({"_id": 1}, {$set: {"7213647182934612837492342341": 1}}); +t.update({"_id": 1}, {$set: {"7213647182934612837492342342": 2}}); q = t.findOne(); assert.eq(q["7213647182934612837492342341"], 1, "A7 1"); assert.eq(q["7213647182934612837492342342"], 2, "A7 2"); // 0s -t.update({"_id" : 1}, {$set : {"actual.000" : "val000"}}); +t.update({"_id": 1}, {$set: {"actual.000": "val000"}}); q = t.findOne(); assert.eq(q.actual["000"], "val000", "A8 zeros"); -t.update({"_id" : 1}, {$set : {"actual.00" : "val00"}}); +t.update({"_id": 1}, {$set: {"actual.00": "val00"}}); q = t.findOne(); assert.eq(q.actual["00"], "val00", "A8 00"); assert.eq(q.actual["000"], "val000", "A9"); -t.update({"_id" : 1}, {$set : {"actual.000" : "val000"}}); +t.update({"_id": 1}, {$set: {"actual.000": "val000"}}); q = t.findOne(); assert.eq(q.actual["000"], "val000", "A9"); assert.eq(q.actual["00"], "val00", "A10"); -t.update({"_id" : 1}, {$set : {"actual.01" : "val01"}}); +t.update({"_id": 1}, {$set: {"actual.01": "val01"}}); q = t.findOne(); assert.eq(q.actual["000"], "val000", "A11"); assert.eq(q.actual["01"], "val01", "A12"); // shouldn't work, but shouldn't do anything too heinous, either -t.update({"_id" : 1}, {$set : {"0.." : "val01"}}); -t.update({"_id" : 1}, {$set : {"0..0" : "val01"}}); -t.update({"_id" : 1}, {$set : {".0" : "val01"}}); -t.update({"_id" : 1}, {$set : {"..0" : "val01"}}); -t.update({"_id" : 1}, {$set : {"0.0..0" : "val01"}}); +t.update({"_id": 1}, {$set: {"0..": "val01"}}); +t.update({"_id": 1}, {$set: {"0..0": "val01"}}); +t.update({"_id": 1}, {$set: {".0": "val01"}}); +t.update({"_id": 1}, {$set: {"..0": "val01"}}); +t.update({"_id": 1}, {$set: {"0.0..0": "val01"}}); |