summaryrefslogtreecommitdiff
path: root/src/mongo/db/matcher/expression_geo.cpp
diff options
context:
space:
mode:
authorBenjamin Murphy <benjamin_murphy@me.com>2016-02-03 11:35:20 -0500
committerBenjamin Murphy <benjamin_murphy@me.com>2016-02-11 10:20:30 -0500
commit5e0ea1eb6b872b35f577104005d2f006d90cf190 (patch)
treeb6a1e763454fe15c214c3001b0de8f2548a95da9 /src/mongo/db/matcher/expression_geo.cpp
parent7fa54380fe62e2f829556fa41c781cdc7bdd7aa6 (diff)
downloadmongo-5e0ea1eb6b872b35f577104005d2f006d90cf190.tar.gz
SERVER-19783 geoNear, near, and nearSphere correctly handle adjacent and child parameters.
Diffstat (limited to 'src/mongo/db/matcher/expression_geo.cpp')
-rw-r--r--src/mongo/db/matcher/expression_geo.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/mongo/db/matcher/expression_geo.cpp b/src/mongo/db/matcher/expression_geo.cpp
index a9e02aa807c..3fa8f20b3d7 100644
--- a/src/mongo/db/matcher/expression_geo.cpp
+++ b/src/mongo/db/matcher/expression_geo.cpp
@@ -196,6 +196,10 @@ bool GeoNearExpression::parseLegacyQuery(const BSONObj& obj) {
uassert(16896, "$maxDistance must be non-negative", maxDistance >= 0.0);
} else if (equals(e.fieldName(), "$uniqueDocs")) {
warning() << "ignoring deprecated option $uniqueDocs";
+ } else {
+ // In a query document, $near queries can have no non-geo sibling parameters.
+ uasserted(34410,
+ str::stream() << "invalid argument in geo near query: " << e.fieldName());
}
}
@@ -258,6 +262,10 @@ Status GeoNearExpression::parseNewQuery(const BSONObj& obj) {
uassert(16899, "$maxDistance must be a number", e.isNumber());
maxDistance = e.Number();
uassert(16900, "$maxDistance must be non-negative", maxDistance >= 0.0);
+ } else {
+ // Return an error if a bad argument was passed inside the query document.
+ return Status(ErrorCodes::BadValue,
+ str::stream() << "invalid argument in geo near query: " << e.fieldName());
}
}