diff options
author | James Wahlin <james.wahlin@10gen.com> | 2016-07-25 16:56:22 -0400 |
---|---|---|
committer | James Wahlin <james.wahlin@10gen.com> | 2016-07-29 15:36:53 -0400 |
commit | dc7f50c520c5129709008568241274cb6d5ec231 (patch) | |
tree | cd38158bf08d17566e706eeb3eb4202d3dfc1044 /src/mongo/db/commands/distinct.cpp | |
parent | d305e618162d37ccc16cf574fcc0388a1160af93 (diff) | |
download | mongo-dc7f50c520c5129709008568241274cb6d5ec231.tar.gz |
SERVER-24762 Support for views on sharded collections
Diffstat (limited to 'src/mongo/db/commands/distinct.cpp')
-rw-r--r-- | src/mongo/db/commands/distinct.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/mongo/db/commands/distinct.cpp b/src/mongo/db/commands/distinct.cpp index a10e7cb3b1f..e571bfee3d3 100644 --- a/src/mongo/db/commands/distinct.cpp +++ b/src/mongo/db/commands/distinct.cpp @@ -30,6 +30,8 @@ #define MONGO_LOG_DEFAULT_COMPONENT ::mongo::logger::LogComponent::kQuery +#include "mongo/platform/basic.h" + #include <string> #include <vector> @@ -56,6 +58,7 @@ #include "mongo/db/query/plan_summary_stats.h" #include "mongo/db/query/query_planner_common.h" #include "mongo/db/query/view_response_formatter.h" +#include "mongo/db/views/resolved_view.h" #include "mongo/stdx/memory.h" #include "mongo/util/log.h" @@ -178,6 +181,11 @@ public: (void)Command::findCommand("aggregate") ->run(txn, dbname, viewAggregation.getValue(), options, errmsg, aggResult); + if (ResolvedView::isResolvedViewErrorResponse(aggResult.asTempObj())) { + result.appendElements(aggResult.obj()); + return false; + } + ViewResponseFormatter formatter(aggResult.obj()); Status formatStatus = formatter.appendAsDistinctResponse(&result); if (!formatStatus.isOK()) { |