diff options
Diffstat (limited to 'jstests/core/geo_fiddly_box.js')
-rw-r--r-- | jstests/core/geo_fiddly_box.js | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/jstests/core/geo_fiddly_box.js b/jstests/core/geo_fiddly_box.js index 95f33a32987..cfda0a99757 100644 --- a/jstests/core/geo_fiddly_box.js +++ b/jstests/core/geo_fiddly_box.js @@ -4,38 +4,38 @@ // "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 = 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() ) +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. epsilon = 0.0001; -min = -1 -max = 1 -step = 1 +min = -1; +max = 1; +step = 1; numItems = 0; -t.drop() -t.ensureIndex({ loc : "2d" }, { max : max + epsilon / 2, min : min - epsilon / 2 }) +t.drop(); +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 } }) + t.insert({ "loc" : { x : x, y : y } }); numItems++; } } |