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/geo1.js | |
parent | a025d43f3ce2efc1fb1282a718f5d286fa0a4dc1 (diff) | |
download | mongo-4ae691e8edc87d0e3cfb633bb91c328426be007b.tar.gz |
SERVER-22468 Format JS code with approved style in jstests/
Diffstat (limited to 'jstests/core/geo1.js')
-rw-r--r-- | jstests/core/geo1.js | 39 |
1 files changed, 21 insertions, 18 deletions
diff --git a/jstests/core/geo1.js b/jstests/core/geo1.js index e1dc23fe153..724ae31a3ce 100644 --- a/jstests/core/geo1.js +++ b/jstests/core/geo1.js @@ -2,36 +2,39 @@ t = db.geo1; t.drop(); -idx = { loc : "2d" , zip : 1 }; +idx = { + loc: "2d", + zip: 1 +}; -t.insert( { zip : "06525" , loc : [ 41.352964 , 73.01212 ] } ); -t.insert( { zip : "10024" , loc : [ 40.786387 , 73.97709 ] } ); -assert.writeOK( t.insert( { zip : "94061" , loc : [ 37.463911 , 122.23396 ] } )); +t.insert({zip: "06525", loc: [41.352964, 73.01212]}); +t.insert({zip: "10024", loc: [40.786387, 73.97709]}); +assert.writeOK(t.insert({zip: "94061", loc: [37.463911, 122.23396]})); // test "2d" has to be first -assert.eq( 1 , t.getIndexKeys().length , "S1" ); -t.ensureIndex( { zip : 1 , loc : "2d" } ); -assert.eq( 1 , t.getIndexKeys().length , "S2" ); +assert.eq(1, t.getIndexKeys().length, "S1"); +t.ensureIndex({zip: 1, loc: "2d"}); +assert.eq(1, t.getIndexKeys().length, "S2"); -t.ensureIndex( idx ); -assert.eq( 2 , t.getIndexKeys().length , "S3" ); +t.ensureIndex(idx); +assert.eq(2, t.getIndexKeys().length, "S3"); -assert.eq( 3 , t.count() , "B1" ); -assert.writeError( t.insert( { loc : [ 200 , 200 ] } )); -assert.eq( 3 , t.count() , "B3" ); +assert.eq(3, t.count(), "B1"); +assert.writeError(t.insert({loc: [200, 200]})); +assert.eq(3, t.count(), "B3"); // test normal access -wb = t.findOne( { zip : "06525" } ); -assert( wb , "C1" ); +wb = t.findOne({zip: "06525"}); +assert(wb, "C1"); -assert.eq( "06525" , t.find( { loc : wb.loc } ).hint( { "$natural" : 1 } )[0].zip , "C2" ); -assert.eq( "06525" , t.find( { loc : wb.loc } )[0].zip , "C3" ); +assert.eq("06525", t.find({loc: wb.loc}).hint({"$natural": 1})[0].zip, "C2"); +assert.eq("06525", t.find({loc: wb.loc})[0].zip, "C3"); // assert.eq( 1 , t.find( { loc : wb.loc } ).explain().nscanned , "C4" ) // test config options t.drop(); -t.ensureIndex( { loc : "2d" } , { min : -500 , max : 500 , bits : 4 } ); -assert.writeOK( t.insert( { loc : [ 200 , 200 ] } )); +t.ensureIndex({loc: "2d"}, {min: -500, max: 500, bits: 4}); +assert.writeOK(t.insert({loc: [200, 200]})); |