summaryrefslogtreecommitdiff
path: root/src/mongo/db/query/canonical_query.cpp
diff options
context:
space:
mode:
authorDrew Paroski <drew.paroski@mongodb.com>2020-04-28 18:36:49 -0400
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2020-06-02 14:24:40 +0000
commit7e28f4296a04d858a2e3dd84a1e79c9ba59a9568 (patch)
treea6e6f9fdfffe9f7e0be7d37269c853a0baf82c96 /src/mongo/db/query/canonical_query.cpp
parent3a737b6beefe346060bbfd64b5c97790d4fd86ad (diff)
SERVER-47773 Error consistently when tailable cursors and $near are used togetherr4.0.19-rc0r4.0.19
(cherry picked from commit c8ced6df8f620daaa2e539f192f2eef356c63e9c) (cherry picked from commit e9c31e791b2e056c016c048d7e21c59e0e2452ea) (cherry picked from commit 444dab325b5351ddd566da1d5365ec8728a06634)
Diffstat (limited to 'src/mongo/db/query/canonical_query.cpp')
-rw-r--r--src/mongo/db/query/canonical_query.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/mongo/db/query/canonical_query.cpp b/src/mongo/db/query/canonical_query.cpp
index 6d2337d92ef..3d15afafe6c 100644
--- a/src/mongo/db/query/canonical_query.cpp
+++ b/src/mongo/db/query/canonical_query.cpp
@@ -404,6 +404,12 @@ Status CanonicalQuery::isValid(MatchExpression* root, const QueryRequest& parsed
return Status(ErrorCodes::BadValue, "text and tailable cursor not allowed in same query");
}
+ // NEAR and tailable are incompatible.
+ if (numGeoNear > 0 && parsed.isTailable()) {
+ return Status(ErrorCodes::BadValue,
+ "Tailable cursors and geo $near cannot be used together");
+ }
+
// $natural sort order must agree with hint.
if (sortNaturalElt) {
if (!hintObj.isEmpty() && !hintNaturalElt) {