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/geo_circle2.js | |
parent | a025d43f3ce2efc1fb1282a718f5d286fa0a4dc1 (diff) | |
download | mongo-4ae691e8edc87d0e3cfb633bb91c328426be007b.tar.gz |
SERVER-22468 Format JS code with approved style in jstests/
Diffstat (limited to 'jstests/core/geo_circle2.js')
-rw-r--r-- | jstests/core/geo_circle2.js | 39 |
1 files changed, 21 insertions, 18 deletions
diff --git a/jstests/core/geo_circle2.js b/jstests/core/geo_circle2.js index 9a3b3c94860..6c89098f684 100644 --- a/jstests/core/geo_circle2.js +++ b/jstests/core/geo_circle2.js @@ -2,25 +2,28 @@ t = db.geo_circle2; t.drop(); -t.ensureIndex({loc : "2d", categories:1}, {"name":"placesIdx", "min": -100, "max": 100}); +t.ensureIndex({loc: "2d", categories: 1}, {"name": "placesIdx", "min": -100, "max": 100}); -t.insert({ "uid" : 368900 , "loc" : { "x" : -36 , "y" : -8} ,"categories" : [ "sports" , "hotel" , "restaurant"]}); -t.insert({ "uid" : 555344 , "loc" : { "x" : 13 , "y" : 29} ,"categories" : [ "sports" , "hotel"]}); -t.insert({ "uid" : 855878 , "loc" : { "x" : 38 , "y" : 30} ,"categories" : [ "sports" , "hotel"]}); -t.insert({ "uid" : 917347 , "loc" : { "x" : 15 , "y" : 46} ,"categories" : [ "hotel"]}); -t.insert({ "uid" : 647874 , "loc" : { "x" : 25 , "y" : 23} ,"categories" : [ "hotel" , "restaurant"]}); -t.insert({ "uid" : 518482 , "loc" : { "x" : 4 , "y" : 25} ,"categories" : [ ]}); -t.insert({ "uid" : 193466 , "loc" : { "x" : -39 , "y" : 22} ,"categories" : [ "sports" , "hotel"]}); -t.insert({ "uid" : 622442 , "loc" : { "x" : -24 , "y" : -46} ,"categories" : [ "hotel"]}); -t.insert({ "uid" : 297426 , "loc" : { "x" : 33 , "y" : -49} ,"categories" : [ "hotel"]}); -t.insert({ "uid" : 528464 , "loc" : { "x" : -43 , "y" : 48} ,"categories" : [ "restaurant"]}); -t.insert({ "uid" : 90579 , "loc" : { "x" : -4 , "y" : -23} ,"categories" : [ "restaurant"]}); -t.insert({ "uid" : 368895 , "loc" : { "x" : -8 , "y" : 14} ,"categories" : [ "sports" ]}); -t.insert({ "uid" : 355844 , "loc" : { "x" : 34 , "y" : -4} ,"categories" : [ "sports" , "hotel"]}); +t.insert( + {"uid": 368900, "loc": {"x": -36, "y": -8}, "categories": ["sports", "hotel", "restaurant"]}); +t.insert({"uid": 555344, "loc": {"x": 13, "y": 29}, "categories": ["sports", "hotel"]}); +t.insert({"uid": 855878, "loc": {"x": 38, "y": 30}, "categories": ["sports", "hotel"]}); +t.insert({"uid": 917347, "loc": {"x": 15, "y": 46}, "categories": ["hotel"]}); +t.insert({"uid": 647874, "loc": {"x": 25, "y": 23}, "categories": ["hotel", "restaurant"]}); +t.insert({"uid": 518482, "loc": {"x": 4, "y": 25}, "categories": []}); +t.insert({"uid": 193466, "loc": {"x": -39, "y": 22}, "categories": ["sports", "hotel"]}); +t.insert({"uid": 622442, "loc": {"x": -24, "y": -46}, "categories": ["hotel"]}); +t.insert({"uid": 297426, "loc": {"x": 33, "y": -49}, "categories": ["hotel"]}); +t.insert({"uid": 528464, "loc": {"x": -43, "y": 48}, "categories": ["restaurant"]}); +t.insert({"uid": 90579, "loc": {"x": -4, "y": -23}, "categories": ["restaurant"]}); +t.insert({"uid": 368895, "loc": {"x": -8, "y": 14}, "categories": ["sports"]}); +t.insert({"uid": 355844, "loc": {"x": 34, "y": -4}, "categories": ["sports", "hotel"]}); - -assert.eq( 10 , t.find({ "loc" : { "$within" : { "$center" : [ { "x" : 0 ,"y" : 0} , 50]}} } ).itcount() , "A" ); -assert.eq( 6 , t.find({ "loc" : { "$within" : { "$center" : [ { "x" : 0 ,"y" : 0} , 50]}}, "categories" : "sports" } ).itcount() , "B" ); +assert.eq(10, t.find({"loc": {"$within": {"$center": [{"x": 0, "y": 0}, 50]}}}).itcount(), "A"); +assert.eq(6, + t.find({"loc": {"$within": {"$center": [{"x": 0, "y": 0}, 50]}}, "categories": "sports"}) + .itcount(), + "B"); // When not a $near or $within query, geo index should not be used. Fails if geo index is used. -assert.eq( 1 , t.find({ "loc" : { "x" : -36, "y" : -8}, "categories" : "sports" }).itcount(), "C" ); +assert.eq(1, t.find({"loc": {"x": -36, "y": -8}, "categories": "sports"}).itcount(), "C"); |