summaryrefslogtreecommitdiff
path: root/jstests/core/geo_uniqueDocs.js
diff options
context:
space:
mode:
Diffstat (limited to 'jstests/core/geo_uniqueDocs.js')
-rw-r--r--jstests/core/geo_uniqueDocs.js38
1 files changed, 21 insertions, 17 deletions
diff --git a/jstests/core/geo_uniqueDocs.js b/jstests/core/geo_uniqueDocs.js
index 23297bb1ec9..8c4e11fc82e 100644
--- a/jstests/core/geo_uniqueDocs.js
+++ b/jstests/core/geo_uniqueDocs.js
@@ -5,36 +5,40 @@ collName = 'geo_uniqueDocs_test';
t = db.geo_uniqueDocs_test;
t.drop();
-t.save( { locs : [ [0,2], [3,4]] } );
-t.save( { locs : [ [6,8], [10,10] ] } );
+t.save({locs: [[0, 2], [3, 4]]});
+t.save({locs: [[6, 8], [10, 10]]});
-t.ensureIndex( { locs : '2d' } );
+t.ensureIndex({locs: '2d'});
// geoNear tests
// uniqueDocs option is ignored.
-assert.eq(2, db.runCommand({geoNear:collName, near:[0,0]}).results.length);
-assert.eq(2, db.runCommand({geoNear:collName, near:[0,0], uniqueDocs:false}).results.length);
-assert.eq(2, db.runCommand({geoNear:collName, near:[0,0], uniqueDocs:true}).results.length);
-results = db.runCommand({geoNear:collName, near:[0,0], num:2}).results;
+assert.eq(2, db.runCommand({geoNear: collName, near: [0, 0]}).results.length);
+assert.eq(2, db.runCommand({geoNear: collName, near: [0, 0], uniqueDocs: false}).results.length);
+assert.eq(2, db.runCommand({geoNear: collName, near: [0, 0], uniqueDocs: true}).results.length);
+results = db.runCommand({geoNear: collName, near: [0, 0], num: 2}).results;
assert.eq(2, results.length);
assert.close(2, results[0].dis);
assert.close(10, results[1].dis);
-results = db.runCommand({geoNear:collName, near:[0,0], num:2, uniqueDocs:true}).results;
+results = db.runCommand({geoNear: collName, near: [0, 0], num: 2, uniqueDocs: true}).results;
assert.eq(2, results.length);
assert.close(2, results[0].dis);
assert.close(10, results[1].dis);
// $within tests
-assert.eq(2, t.find( {locs: {$within: {$box : [[0,0],[9,9]]}}}).itcount());
-assert.eq(2, t.find( {locs: {$within: {$box : [[0,0],[9,9]], $uniqueDocs : true}}}).itcount());
-assert.eq(2, t.find( {locs: {$within: {$box : [[0,0],[9,9]], $uniqueDocs : false}}}).itcount());
+assert.eq(2, t.find({locs: {$within: {$box: [[0, 0], [9, 9]]}}}).itcount());
+assert.eq(2, t.find({locs: {$within: {$box: [[0, 0], [9, 9]], $uniqueDocs: true}}}).itcount());
+assert.eq(2, t.find({locs: {$within: {$box: [[0, 0], [9, 9]], $uniqueDocs: false}}}).itcount());
-assert.eq(2, t.find( {locs: {$within: {$center : [[5,5],7], $uniqueDocs : true}}}).itcount());
-assert.eq(2, t.find( {locs: {$within: {$center : [[5,5],7], $uniqueDocs : false}}}).itcount());
+assert.eq(2, t.find({locs: {$within: {$center: [[5, 5], 7], $uniqueDocs: true}}}).itcount());
+assert.eq(2, t.find({locs: {$within: {$center: [[5, 5], 7], $uniqueDocs: false}}}).itcount());
-assert.eq(2, t.find( {locs: {$within: {$centerSphere : [[5,5],1], $uniqueDocs : true}}}).itcount());
-assert.eq(2, t.find( {locs: {$within: {$centerSphere : [[5,5],1], $uniqueDocs : false}}}).itcount());
+assert.eq(2, t.find({locs: {$within: {$centerSphere: [[5, 5], 1], $uniqueDocs: true}}}).itcount());
+assert.eq(2, t.find({locs: {$within: {$centerSphere: [[5, 5], 1], $uniqueDocs: false}}}).itcount());
-assert.eq(2, t.find( {locs: {$within: {$polygon : [[0,0],[0,9],[9,9]], $uniqueDocs : true}}}).itcount());
-assert.eq(2, t.find( {locs: {$within: {$polygon : [[0,0],[0,9],[9,9]], $uniqueDocs : false}}}).itcount());
+assert.eq(2,
+ t.find({locs: {$within: {$polygon: [[0, 0], [0, 9], [9, 9]], $uniqueDocs: true}}})
+ .itcount());
+assert.eq(2,
+ t.find({locs: {$within: {$polygon: [[0, 0], [0, 9], [9, 9]], $uniqueDocs: false}}})
+ .itcount());