diff options
author | Mike Grundy <michael.grundy@10gen.com> | 2016-02-04 12:29:01 -0500 |
---|---|---|
committer | Mike Grundy <michael.grundy@10gen.com> | 2016-02-09 13:41:02 -0500 |
commit | 3bed8596d18275d1561e4f44f1f0bd72c1e038f1 (patch) | |
tree | 788eaed3c7a692a424f080d16a8841dc8afa3c13 /jstests/core/geo_s2nearComplex.js | |
parent | 985e2a0be95709ac064c57f0a9bb385a55937285 (diff) | |
download | mongo-3bed8596d18275d1561e4f44f1f0bd72c1e038f1.tar.gz |
SERVER-22341 fix jslint errors in jstests/core with eslint --fix
Conflicts:
jstests/core/count_hint.js
Diffstat (limited to 'jstests/core/geo_s2nearComplex.js')
-rw-r--r-- | jstests/core/geo_s2nearComplex.js | 76 |
1 files changed, 38 insertions, 38 deletions
diff --git a/jstests/core/geo_s2nearComplex.js b/jstests/core/geo_s2nearComplex.js index e6fa1f77bd7..ecb5e646a54 100644 --- a/jstests/core/geo_s2nearComplex.js +++ b/jstests/core/geo_s2nearComplex.js @@ -1,6 +1,6 @@ -var t = db.get_s2nearcomplex -t.drop() -t.ensureIndex({geo: "2dsphere"}) +var t = db.get_s2nearcomplex; +t.drop(); +t.ensureIndex({geo: "2dsphere"}); /* Short names for math operations */ Random.setRandomSeed(); @@ -9,7 +9,7 @@ var PI = Math.PI; var asin = Math.asin; var sin = Math.sin; var cos = Math.cos; -var atan2 = Math.atan2 +var atan2 = Math.atan2; var originGeo = {type: "Point", coordinates: [20.0, 20.0]}; @@ -17,7 +17,7 @@ var originGeo = {type: "Point", coordinates: [20.0, 20.0]}; var origin = { name: "origin", geo: originGeo -} +}; /* @@ -25,9 +25,9 @@ var origin = { * specify how accurate equals should be. */ function coordinateEqual(first, second, threshold){ - threshold = threshold || 0.001 - first = first['geo']['coordinates'] - second = second['geo']['coordinates'] + threshold = threshold || 0.001; + first = first['geo']['coordinates']; + second = second['geo']['coordinates']; if(Math.abs(first[0] - second[0]) <= threshold){ if(Math.abs(first[1] - second[1]) <= threshold){ return true; @@ -106,7 +106,7 @@ function uniformPointsWithGaps(origin, count, minDist, maxDist, numberOfHoles, s * covers as a fraction of the full area that points are created on. Defaults to 10. */ function uniformPointsWithClusters(origin, count, minDist, maxDist, numberOfClusters, minClusterSize, maxClusterSize, distRatio){ - distRatio = distRatio || 10 + distRatio = distRatio || 10; var points = uniformPoints(origin, count, minDist, maxDist); for(j=0; j<numberOfClusters; j++){ var randomPoint = points[Math.floor(random() * points.length)]; @@ -161,40 +161,40 @@ var query = {geo: {$geoNear: {$geometry: originGeo}}}; // Test a uniform distribution of 1000 points. uniformPoints(origin, 1000, 0.5, 1.5); -validateOrdering({geo: {$geoNear: {$geometry: originGeo}}}) +validateOrdering({geo: {$geoNear: {$geometry: originGeo}}}); -print("Millis for uniform:") +print("Millis for uniform:"); print(t.find(query).explain("executionStats").executionStats.executionTimeMillis); print("Total points:"); print(t.find(query).itcount()); -t.drop() -t.ensureIndex({geo: "2dsphere"}) +t.drop(); +t.ensureIndex({geo: "2dsphere"}); // Test a uniform distribution with 5 gaps each with 10 points missing. uniformPointsWithGaps(origin, 1000, 1, 10.0, 5, 10); -validateOrdering({geo: {$geoNear: {$geometry: originGeo}}}) +validateOrdering({geo: {$geoNear: {$geometry: originGeo}}}); -print("Millis for uniform with gaps:") +print("Millis for uniform with gaps:"); print(t.find(query).explain("executionStats").executionStats.executionTimeMillis); print("Total points:"); print(t.find(query).itcount()); -t.drop() -t.ensureIndex({geo: "2dsphere"}) +t.drop(); +t.ensureIndex({geo: "2dsphere"}); // Test a uniform distribution with 5 clusters each with between 10 and 100 points. uniformPointsWithClusters(origin, 1000, 1, 10.0, 5, 10, 100); -validateOrdering({geo: {$geoNear: {$geometry: originGeo}}}) +validateOrdering({geo: {$geoNear: {$geometry: originGeo}}}); print("Millis for uniform with clusters:"); print(t.find(query).explain("executionStats").executionStats.executionTimeMillis); print("Total points:"); print(t.find(query).itcount()); -t.drop() -t.ensureIndex({geo: "2dsphere"}) +t.drop(); +t.ensureIndex({geo: "2dsphere"}); // Test a uniform near search with origin around the pole. @@ -203,46 +203,46 @@ originGeo = {type: "Point", coordinates: [0.0, 89.0]}; origin = { name: "origin", geo: originGeo -} +}; uniformPoints(origin, 50, 0.5, 1.5); -validateOrdering({geo: {$geoNear: {$geometry: originGeo}}}) +validateOrdering({geo: {$geoNear: {$geometry: originGeo}}}); -print("Millis for uniform near pole:") +print("Millis for uniform near pole:"); print(t.find({geo: {$geoNear: {$geometry: originGeo}}}) .explain("executionStats").executionStats.executionTimeMillis); assert.eq(t.find({geo: {$geoNear: {$geometry: originGeo}}}).itcount(), 50); -t.drop() -t.ensureIndex({geo: "2dsphere"}) +t.drop(); +t.ensureIndex({geo: "2dsphere"}); // Center point near the meridian originGeo = {type: "Point", coordinates: [179.0, 0.0]}; origin = { name: "origin", geo: originGeo -} +}; uniformPoints(origin, 50, 0.5, 1.5); -validateOrdering({geo: {$geoNear: {$geometry: originGeo}}}) +validateOrdering({geo: {$geoNear: {$geometry: originGeo}}}); -print("Millis for uniform on meridian:") +print("Millis for uniform on meridian:"); print(t.find({geo: {$geoNear: {$geometry: originGeo}}}) .explain("executionStats").executionStats.executionTimeMillis); assert.eq(t.find({geo: {$geoNear: {$geometry: originGeo}}}).itcount(), 50); -t.drop() -t.ensureIndex({geo: "2dsphere"}) +t.drop(); +t.ensureIndex({geo: "2dsphere"}); // Center point near the negative meridian originGeo = {type: "Point", coordinates: [-179.0, 0.0]}; origin = { name: "origin", geo: originGeo -} +}; uniformPoints(origin, 50, 0.5, 1.5); -validateOrdering({geo: {$near: {$geometry: originGeo}}}) +validateOrdering({geo: {$near: {$geometry: originGeo}}}); print("Millis for uniform on negative meridian:"); print(t.find({geo: {$geoNear: {$geometry: originGeo}}}) @@ -250,23 +250,23 @@ print(t.find({geo: {$geoNear: {$geometry: originGeo}}}) assert.eq(t.find({geo: {$near: {$geometry: originGeo}}}).itcount(), 50); // Near search with points that are really far away. -t.drop() -t.ensureIndex({geo: "2dsphere"}) +t.drop(); +t.ensureIndex({geo: "2dsphere"}); originGeo = {type: "Point", coordinates: [0.0, 0.0]}; origin = { name: "origin", geo: originGeo -} +}; uniformPoints(origin, 10, 89, 90); -cur = t.find({geo: {$near: {$geometry: originGeo}}}) +cur = t.find({geo: {$near: {$geometry: originGeo}}}); assert.eq(cur.itcount(), 10); -cur = t.find({geo: {$near: {$geometry: originGeo}}}) +cur = t.find({geo: {$near: {$geometry: originGeo}}}); print("Near search on very distant points:"); print(t.find({geo: {$geoNear: {$geometry: originGeo}}}) .explain("executionStats").executionStats.executionTimeMillis); pt = cur.next(); -assert(pt) +assert(pt); |