diff options
author | Hari Khalsa <hkhalsa@10gen.com> | 2014-04-21 11:17:47 -0400 |
---|---|---|
committer | Dan Pasette <dan@mongodb.com> | 2014-04-21 13:59:02 -0400 |
commit | 246bfa4e9c365f585e3dc323f91b72e1dd16d127 (patch) | |
tree | 472ce979cdfbbde9e2c6d0307cedd3579a6a188a | |
parent | 66da6ee14e6de327285f76ae73e48a56788ab901 (diff) | |
download | mongo-246bfa4e9c365f585e3dc323f91b72e1dd16d127.tar.gz |
SERVER-13666 check that lat/lng are in bounds for near queries even if point is legacy
(cherry picked from commit 3286b208b30c43450354422e554070485f526e7b)
-rw-r--r-- | jstests/core/geo_s2near.js | 3 | ||||
-rw-r--r-- | src/mongo/db/geo/geoquery.cpp | 7 |
2 files changed, 10 insertions, 0 deletions
diff --git a/jstests/core/geo_s2near.js b/jstests/core/geo_s2near.js index 136e821b4b8..240e10d633a 100644 --- a/jstests/core/geo_s2near.js +++ b/jstests/core/geo_s2near.js @@ -82,3 +82,6 @@ testRadAndDegreesOK(1); testRadAndDegreesOK(10) testRadAndDegreesOK(50) testRadAndDegreesOK(10000) + +// SERVER-13666 legacy coordinates must be in bounds for spherical near queries. +assert.commandFailed(db.runCommand({geoNear : t.getName(), near: [1210.466, 31.2051], spherical: true, num: 10})); diff --git a/src/mongo/db/geo/geoquery.cpp b/src/mongo/db/geo/geoquery.cpp index 024129cd01e..cc1c0b45309 100644 --- a/src/mongo/db/geo/geoquery.cpp +++ b/src/mongo/db/geo/geoquery.cpp @@ -68,6 +68,13 @@ namespace mongo { } } + // The user-provided point can be flat. We need to make sure that it's in bounds. + if (isNearSphere) { + uassert(17444, + "Legacy point is out of bounds for spherical query", + centroid.flatUpgradedToSphere || (SPHERE == centroid.crs)); + } + return hasGeometry; } |