summaryrefslogtreecommitdiff
path: root/src/mongo/s/query
diff options
context:
space:
mode:
authorDavid Storch <david.storch@10gen.com>2015-09-28 11:38:52 -0400
committerDavid Storch <david.storch@10gen.com>2015-09-28 17:23:10 -0400
commit640902d3f0fd65c0188ef057706746fb9f5eaa87 (patch)
treed5253eed8a4a8c12244b6edf85c6514bb2090859 /src/mongo/s/query
parent3f5e0f5f9e9c96327aa760373677d11e905280de (diff)
downloadmongo-640902d3f0fd65c0188ef057706746fb9f5eaa87.tar.gz
SERVER-20660 fix mongos to not pass sortKey meta-projection with a $natural sort
Diffstat (limited to 'src/mongo/s/query')
-rw-r--r--src/mongo/s/query/cluster_find.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/mongo/s/query/cluster_find.cpp b/src/mongo/s/query/cluster_find.cpp
index 92ac88152ef..81aa71e2d36 100644
--- a/src/mongo/s/query/cluster_find.cpp
+++ b/src/mongo/s/query/cluster_find.cpp
@@ -89,9 +89,9 @@ std::unique_ptr<LiteParsedQuery> transformQueryForShards(const LiteParsedQuery&
newNToReturn = *lpq.getNToReturn() + lpq.getSkip().value_or(0);
}
- // If there is a sort, we send a sortKey meta-projection to the remote node.
+ // If there is a sort other than $natural, we send a sortKey meta-projection to the remote node.
BSONObj newProjection = lpq.getProj();
- if (!lpq.getSort().isEmpty()) {
+ if (!lpq.getSort().isEmpty() && !lpq.getSort()["$natural"]) {
BSONObjBuilder projectionBuilder;
projectionBuilder.appendElements(lpq.getProj());
projectionBuilder.append(ClusterClientCursorParams::kSortKeyField, kSortKeyMetaProjection);