summaryrefslogtreecommitdiff
path: root/jstests/core/geo_fiddly_box.js
diff options
context:
space:
mode:
authorJonathan Abrahams <jonathan@mongodb.com>2016-03-09 12:17:50 -0500
committerJonathan Abrahams <jonathan@mongodb.com>2016-03-09 12:18:14 -0500
commit4ae691e8edc87d0e3cfb633bb91c328426be007b (patch)
tree52079a593f54382ca13a2e741633eab1b6271893 /jstests/core/geo_fiddly_box.js
parenta025d43f3ce2efc1fb1282a718f5d286fa0a4dc1 (diff)
downloadmongo-4ae691e8edc87d0e3cfb633bb91c328426be007b.tar.gz
SERVER-22468 Format JS code with approved style in jstests/
Diffstat (limited to 'jstests/core/geo_fiddly_box.js')
-rw-r--r--jstests/core/geo_fiddly_box.js53
1 files changed, 31 insertions, 22 deletions
diff --git a/jstests/core/geo_fiddly_box.js b/jstests/core/geo_fiddly_box.js
index cfda0a99757..f5cd3ddcc6b 100644
--- a/jstests/core/geo_fiddly_box.js
+++ b/jstests/core/geo_fiddly_box.js
@@ -1,26 +1,27 @@
// Reproduces simple test for SERVER-2832
-// The setup to reproduce was/is to create a set of points where the
+// The setup to reproduce was/is to create a set of points where the
// "expand" portion of the geo-lookup expands the 2d range in only one
// direction (so points are required on either side of the expanding range)
t = db.geo_fiddly_box;
t.drop();
-t.ensureIndex({ loc : "2d" });
+t.ensureIndex({loc: "2d"});
-t.insert({ "loc" : [3, 1] });
-t.insert({ "loc" : [3, 0.5] });
-t.insert({ "loc" : [3, 0.25] });
-t.insert({ "loc" : [3, -0.01] });
-t.insert({ "loc" : [3, -0.25] });
-t.insert({ "loc" : [3, -0.5] });
-t.insert({ "loc" : [3, -1] });
+t.insert({"loc": [3, 1]});
+t.insert({"loc": [3, 0.5]});
+t.insert({"loc": [3, 0.25]});
+t.insert({"loc": [3, -0.01]});
+t.insert({"loc": [3, -0.25]});
+t.insert({"loc": [3, -0.5]});
+t.insert({"loc": [3, -1]});
// OK!
-print( t.count() );
-assert.eq( 7, t.count({ "loc" : { "$within" : { "$box" : [ [2, -2], [46, 2] ] } } }), "Not all locations found!" );
-
+print(t.count());
+assert.eq(7,
+ t.count({"loc": {"$within": {"$box": [[2, -2], [46, 2]]}}}),
+ "Not all locations found!");
// Test normal lookup of a small square of points as a sanity check.
@@ -31,16 +32,24 @@ step = 1;
numItems = 0;
t.drop();
-t.ensureIndex({ loc : "2d" }, { max : max + epsilon / 2, min : min - epsilon / 2 });
+t.ensureIndex({loc: "2d"}, {max: max + epsilon / 2, min: min - epsilon / 2});
-for(var x = min; x <= max; x += step){
- for(var y = min; y <= max; y += step){
- t.insert({ "loc" : { x : x, y : y } });
- numItems++;
- }
+for (var x = min; x <= max; x += step) {
+ for (var y = min; y <= max; y += step) {
+ t.insert({"loc": {x: x, y: y}});
+ numItems++;
+ }
}
-assert.eq( numItems, t.count({ loc : { $within : { $box : [[min - epsilon / 3,
- min - epsilon / 3],
- [max + epsilon / 3,
- max + epsilon / 3]] } } }), "Not all locations found!");
+assert.eq(numItems,
+ t.count({
+ loc: {
+ $within: {
+ $box: [
+ [min - epsilon / 3, min - epsilon / 3],
+ [max + epsilon / 3, max + epsilon / 3]
+ ]
+ }
+ }
+ }),
+ "Not all locations found!");