diff options
author | samontea <merciers.merciers@gmail.com> | 2021-02-08 19:00:08 +0000 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2021-02-08 21:18:33 +0000 |
commit | 6a5e743910ad6b2d9aea53aae046b2a0b63d3198 (patch) | |
tree | 65d4b37df29bc0cc1530513fc5d1d684339ab24f /src/mongo/s | |
parent | 19940de8b056ec9441c97f824e7adc508b444a40 (diff) | |
download | mongo-6a5e743910ad6b2d9aea53aae046b2a0b63d3198.tar.gz |
SERVER-53127 Let AggregationRequestHelper::parseFromBSON() return an AggregateCommand
Diffstat (limited to 'src/mongo/s')
-rw-r--r-- | src/mongo/s/commands/cluster_count_cmd.cpp | 9 | ||||
-rw-r--r-- | src/mongo/s/commands/cluster_distinct_cmd.cpp | 9 | ||||
-rw-r--r-- | src/mongo/s/commands/cluster_find_cmd.cpp | 8 | ||||
-rw-r--r-- | src/mongo/s/commands/cluster_pipeline_cmd.cpp | 4 |
4 files changed, 12 insertions, 18 deletions
diff --git a/src/mongo/s/commands/cluster_count_cmd.cpp b/src/mongo/s/commands/cluster_count_cmd.cpp index 22c69d70e43..cf8f22a44fd 100644 --- a/src/mongo/s/commands/cluster_count_cmd.cpp +++ b/src/mongo/s/commands/cluster_count_cmd.cpp @@ -129,11 +129,11 @@ public: auto aggCmdOnView = uassertStatusOK(countCommandAsAggregationCommand(countRequest, nss)); auto aggCmdOnViewObj = OpMsgRequest::fromDBAndBody(nss.db(), aggCmdOnView).body; - auto aggRequestOnView = uassertStatusOK(aggregation_request_helper::parseFromBSON( + auto aggRequestOnView = aggregation_request_helper::parseFromBSON( nss, aggCmdOnViewObj, boost::none, - APIParameters::get(opCtx).getAPIStrict().value_or(false))); + APIParameters::get(opCtx).getAPIStrict().value_or(false)); auto resolvedAggRequest = ex->asExpandedViewAggregation(aggRequestOnView); auto resolvedAggCmd = @@ -248,15 +248,12 @@ public: aggCmdOnViewObj, verbosity, APIParameters::get(opCtx).getAPIStrict().value_or(false)); - if (!aggRequestOnView.isOK()) { - return aggRequestOnView.getStatus(); - } auto bodyBuilder = result->getBodyBuilder(); // An empty PrivilegeVector is acceptable because these privileges are only checked on // getMore and explain will not open a cursor. return ClusterAggregate::retryOnViewError(opCtx, - aggRequestOnView.getValue(), + aggRequestOnView, *ex.extraInfo<ResolvedView>(), nss, PrivilegeVector(), diff --git a/src/mongo/s/commands/cluster_distinct_cmd.cpp b/src/mongo/s/commands/cluster_distinct_cmd.cpp index 7d1e5bc7c0b..7e695d526e2 100644 --- a/src/mongo/s/commands/cluster_distinct_cmd.cpp +++ b/src/mongo/s/commands/cluster_distinct_cmd.cpp @@ -138,15 +138,13 @@ public: viewAggCmd, verbosity, APIParameters::get(opCtx).getAPIStrict().value_or(false)); - if (!aggRequestOnView.isOK()) { - return aggRequestOnView.getStatus(); - } + auto bodyBuilder = result->getBodyBuilder(); // An empty PrivilegeVector is acceptable because these privileges are only checked on // getMore and explain will not open a cursor. return ClusterAggregate::retryOnViewError(opCtx, - aggRequestOnView.getValue(), + aggRequestOnView, *ex.extraInfo<ResolvedView>(), nss, PrivilegeVector(), @@ -216,9 +214,8 @@ public: viewAggCmd, boost::none, APIParameters::get(opCtx).getAPIStrict().value_or(false)); - uassertStatusOK(aggRequestOnView.getStatus()); - auto resolvedAggRequest = ex->asExpandedViewAggregation(aggRequestOnView.getValue()); + auto resolvedAggRequest = ex->asExpandedViewAggregation(aggRequestOnView); auto resolvedAggCmd = aggregation_request_helper::serializeToCommandObj(resolvedAggRequest); diff --git a/src/mongo/s/commands/cluster_find_cmd.cpp b/src/mongo/s/commands/cluster_find_cmd.cpp index 813bee06bad..1199afe30ad 100644 --- a/src/mongo/s/commands/cluster_find_cmd.cpp +++ b/src/mongo/s/commands/cluster_find_cmd.cpp @@ -198,11 +198,11 @@ public: auto viewAggregationCommand = OpMsgRequest::fromDBAndBody(_dbName, aggCmdOnView).body; - auto aggRequestOnView = uassertStatusOK(aggregation_request_helper::parseFromBSON( + auto aggRequestOnView = aggregation_request_helper::parseFromBSON( ns(), viewAggregationCommand, verbosity, - APIParameters::get(opCtx).getAPIStrict().value_or(false))); + APIParameters::get(opCtx).getAPIStrict().value_or(false)); // An empty PrivilegeVector is acceptable because these privileges are only checked // on getMore and explain will not open a cursor. @@ -264,11 +264,11 @@ public: auto viewAggregationCommand = OpMsgRequest::fromDBAndBody(_dbName, aggCmdOnView).body; - auto aggRequestOnView = uassertStatusOK(aggregation_request_helper::parseFromBSON( + auto aggRequestOnView = aggregation_request_helper::parseFromBSON( ns(), viewAggregationCommand, boost::none, - APIParameters::get(opCtx).getAPIStrict().value_or(false))); + APIParameters::get(opCtx).getAPIStrict().value_or(false)); auto bodyBuilder = result->getBodyBuilder(); uassertStatusOK(ClusterAggregate::retryOnViewError( diff --git a/src/mongo/s/commands/cluster_pipeline_cmd.cpp b/src/mongo/s/commands/cluster_pipeline_cmd.cpp index 8568a46d9aa..d8adbc4ed5b 100644 --- a/src/mongo/s/commands/cluster_pipeline_cmd.cpp +++ b/src/mongo/s/commands/cluster_pipeline_cmd.cpp @@ -73,11 +73,11 @@ public: OperationContext* opCtx, const OpMsgRequest& opMsgRequest, boost::optional<ExplainOptions::Verbosity> explainVerbosity) override { - const auto aggregationRequest = uassertStatusOK(aggregation_request_helper::parseFromBSON( + const auto aggregationRequest = aggregation_request_helper::parseFromBSON( opMsgRequest.getDatabase().toString(), opMsgRequest.body, explainVerbosity, - APIParameters::get(opCtx).getAPIStrict().value_or(false))); + APIParameters::get(opCtx).getAPIStrict().value_or(false)); auto privileges = uassertStatusOK(AuthorizationSession::get(opCtx->getClient()) |