summaryrefslogtreecommitdiff
path: root/src/mongo/db
diff options
context:
space:
mode:
authorMihai Andrei <mihai.andrei@mongodb.com>2019-11-06 14:32:36 +0000
committerevergreen <evergreen@mongodb.com>2019-11-06 14:32:36 +0000
commit7a1dcf206312805db97599aaf676f7d749a1d9e5 (patch)
tree01451f750005cbdf26c6b4ec98aedfa172538585 /src/mongo/db
parent92fea5be74359277835147762535c642e4cf2461 (diff)
downloadmongo-7a1dcf206312805db97599aaf676f7d749a1d9e5.tar.gz
SERVER-44380 Update computation of _boundsIncrement in GeoNear2DStage::initialize to avoid rounding error
Diffstat (limited to 'src/mongo/db')
-rw-r--r--src/mongo/db/exec/geo_near.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/mongo/db/exec/geo_near.cpp b/src/mongo/db/exec/geo_near.cpp
index 87b7d150348..b91f1cbfbb3 100644
--- a/src/mongo/db/exec/geo_near.cpp
+++ b/src/mongo/db/exec/geo_near.cpp
@@ -420,8 +420,8 @@ PlanStage::StageState GeoNear2DStage::initialize(OperationContext* opCtx,
// Estimator finished its work, we need to finish initialization too.
if (SPHERE == _nearParams.nearQuery->centroid->crs) {
- // Estimated distance is in degrees, convert it to meters.
- _boundsIncrement = deg2rad(estimatedDistance) * kRadiusOfEarthInMeters * 3;
+ // Estimated distance is in degrees, convert it to meters multiplied by 3.
+ _boundsIncrement = (estimatedDistance * kRadiusOfEarthInMeters * 3) * (M_PI / 180);
// Limit boundsIncrement to ~20KM, so that the first circle won't be too aggressive.
_boundsIncrement = std::min(_boundsIncrement, kMaxEarthDistanceInMeters / 1000.0);
} else {