diff options
author | Maddie Zechar <mez2113@columbia.edu> | 2023-03-03 22:59:04 +0000 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2023-03-04 02:24:35 +0000 |
commit | 1dddbcb90ec75240c29f04e00bd9486585bdb198 (patch) | |
tree | c859e5ce254069d2284a8ebc419e25200b50eadc /src/mongo/db/matcher | |
parent | 83a31ef7599f567a16a98ed355adffd511d3677b (diff) | |
download | mongo-1dddbcb90ec75240c29f04e00bd9486585bdb198.tar.gz |
SERVER-57932 Improve error message for $near in aggregation to suggest workarounds
Diffstat (limited to 'src/mongo/db/matcher')
-rw-r--r-- | src/mongo/db/matcher/expression_parser.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/mongo/db/matcher/expression_parser.cpp b/src/mongo/db/matcher/expression_parser.cpp index d902fd617a4..8d64cd19abd 100644 --- a/src/mongo/db/matcher/expression_parser.cpp +++ b/src/mongo/db/matcher/expression_parser.cpp @@ -1216,7 +1216,12 @@ StatusWithMatchExpression parseGeo(boost::optional<StringData> name, if ((allowedFeatures & MatchExpressionParser::AllowedFeatures::kGeoNear) == 0u) { return {Status(ErrorCodes::Error(5626500), - "$geoNear, $near, and $nearSphere are not allowed in this context")}; + "$geoNear, $near, and $nearSphere are not allowed in this context, " + "as these operators require sorting geospatial data. If you do not " + "need sort, consider using $geoWithin instead. Check out " + "https://dochub.mongodb.org/core/near-sort-operation and " + "https://dochub.mongodb.org/core/nearSphere-sort-operation" + "for more details.")}; } auto nq = std::make_unique<GeoNearExpression>(name ? name->toString() : ""); |