summaryrefslogtreecommitdiff
path: root/jstests/core/geo_box1_noindex.js
diff options
context:
space:
mode:
Diffstat (limited to 'jstests/core/geo_box1_noindex.js')
-rw-r--r--jstests/core/geo_box1_noindex.js46
1 files changed, 23 insertions, 23 deletions
diff --git a/jstests/core/geo_box1_noindex.js b/jstests/core/geo_box1_noindex.js
index abf21266dac..36e932105a6 100644
--- a/jstests/core/geo_box1_noindex.js
+++ b/jstests/core/geo_box1_noindex.js
@@ -3,36 +3,36 @@ t = db.geo_box1_noindex;
t.drop();
num = 0;
-for ( x=0; x<=20; x++ ){
- for ( y=0; y<=20; y++ ){
- o = { _id : num++ , loc : [ x , y ] };
- t.save( o );
+for (x = 0; x <= 20; x++) {
+ for (y = 0; y <= 20; y++) {
+ o = {
+ _id: num++,
+ loc: [x, y]
+ };
+ t.save(o);
}
}
-searches = [
- [ [ 1 , 2 ] , [ 4 , 5 ] ] ,
- [ [ 1 , 1 ] , [ 2 , 2 ] ] ,
- [ [ 0 , 2 ] , [ 4 , 5 ] ] ,
- [ [ 1 , 1 ] , [ 2 , 8 ] ] ,
-];
+searches = [[[1, 2], [4, 5]], [[1, 1], [2, 2]], [[0, 2], [4, 5]], [[1, 1], [2, 8]], ];
-for ( i=0; i<searches.length; i++ ){
+for (i = 0; i < searches.length; i++) {
b = searches[i];
- q = { loc : { $within : { $box : b } } };
- numWanted = ( 1 + b[1][0] - b[0][0] ) * ( 1 + b[1][1] - b[0][1] );
- assert.eq( numWanted , t.find(q).itcount() , "itcount: " + tojson( q ) );
- printjson( t.find(q).explain() );
+ q = {
+ loc: {$within: {$box: b}}
+ };
+ numWanted = (1 + b[1][0] - b[0][0]) * (1 + b[1][1] - b[0][1]);
+ assert.eq(numWanted, t.find(q).itcount(), "itcount: " + tojson(q));
+ printjson(t.find(q).explain());
}
-assert.eq( 0 , t.find( { loc : { $within : { $box : [ [100 , 100 ] , [ 110 , 110 ] ] } } } ).itcount() , "E1" );
-assert.eq( 0 , t.find( { loc : { $within : { $box : [ [100 , 100 ] , [ 110 , 110 ] ] } } } ).count() , "E2" );
-assert.eq( num , t.find( { loc : { $within : { $box : [ [ 0 , 0 ] , [ 110 , 110 ] ] } } } ).count() , "E3" );
-assert.eq( num , t.find( { loc : { $within : { $box : [ [ 0 , 0 ] , [ 110 , 110 ] ] } } } ).itcount() , "E4" );
-assert.eq( 57 , t.find( { loc : { $within : { $box : [ [ 0 , 0 ] , [ 110 , 110 ] ] } } } ).limit(57).itcount() , "E5" );
+assert.eq(0, t.find({loc: {$within: {$box: [[100, 100], [110, 110]]}}}).itcount(), "E1");
+assert.eq(0, t.find({loc: {$within: {$box: [[100, 100], [110, 110]]}}}).count(), "E2");
+assert.eq(num, t.find({loc: {$within: {$box: [[0, 0], [110, 110]]}}}).count(), "E3");
+assert.eq(num, t.find({loc: {$within: {$box: [[0, 0], [110, 110]]}}}).itcount(), "E4");
+assert.eq(57, t.find({loc: {$within: {$box: [[0, 0], [110, 110]]}}}).limit(57).itcount(), "E5");
// SERVER-13621
// Eetect and invert the $box coordinates when they're specified incorrectly.
-assert.eq( num , t.find( { loc : { $within : { $box : [ [ 110 , 110 ], [ 0 , 0 ] ] } } } ).count() , "E5" );
-assert.eq( num , t.find( { loc : { $within : { $box : [ [ 110 , 0 ], [ 0 , 110 ] ] } } } ).count() , "E6" );
-assert.eq( num , t.find( { loc : { $within : { $box : [ [ 0 , 110 ], [ 110 , 0 ] ] } } } ).count() , "E7" );
+assert.eq(num, t.find({loc: {$within: {$box: [[110, 110], [0, 0]]}}}).count(), "E5");
+assert.eq(num, t.find({loc: {$within: {$box: [[110, 0], [0, 110]]}}}).count(), "E6");
+assert.eq(num, t.find({loc: {$within: {$box: [[0, 110], [110, 0]]}}}).count(), "E7");