diff options
Diffstat (limited to 'src/mongo/s/commands')
-rw-r--r-- | src/mongo/s/commands/cluster_aggregate_test.cpp | 2 | ||||
-rw-r--r-- | src/mongo/s/commands/cluster_count_cmd.cpp | 14 | ||||
-rw-r--r-- | src/mongo/s/commands/cluster_distinct_cmd.cpp | 13 | ||||
-rw-r--r-- | src/mongo/s/commands/cluster_find_cmd.cpp | 18 | ||||
-rw-r--r-- | src/mongo/s/commands/cluster_pipeline_cmd.cpp | 5 | ||||
-rw-r--r-- | src/mongo/s/commands/strategy.cpp | 4 |
6 files changed, 41 insertions, 15 deletions
diff --git a/src/mongo/s/commands/cluster_aggregate_test.cpp b/src/mongo/s/commands/cluster_aggregate_test.cpp index 17700666352..dfae0f183db 100644 --- a/src/mongo/s/commands/cluster_aggregate_test.cpp +++ b/src/mongo/s/commands/cluster_aggregate_test.cpp @@ -95,7 +95,7 @@ protected: NamespaceString nss{"a.collection"}; auto client = getServiceContext()->makeClient("ClusterCmdClient"); auto opCtx = client->makeOperationContext(); - auto request = aggregation_request_helper::parseFromBSON(nss, inputBson); + auto request = aggregation_request_helper::parseFromBSONForTests(nss, inputBson); if (request.getStatus() != Status::OK()) { return request.getStatus(); } diff --git a/src/mongo/s/commands/cluster_count_cmd.cpp b/src/mongo/s/commands/cluster_count_cmd.cpp index 3ade68c8bd7..22c69d70e43 100644 --- a/src/mongo/s/commands/cluster_count_cmd.cpp +++ b/src/mongo/s/commands/cluster_count_cmd.cpp @@ -129,8 +129,11 @@ public: auto aggCmdOnView = uassertStatusOK(countCommandAsAggregationCommand(countRequest, nss)); auto aggCmdOnViewObj = OpMsgRequest::fromDBAndBody(nss.db(), aggCmdOnView).body; - auto aggRequestOnView = - uassertStatusOK(aggregation_request_helper::parseFromBSON(nss, aggCmdOnViewObj)); + auto aggRequestOnView = uassertStatusOK(aggregation_request_helper::parseFromBSON( + nss, + aggCmdOnViewObj, + boost::none, + APIParameters::get(opCtx).getAPIStrict().value_or(false))); auto resolvedAggRequest = ex->asExpandedViewAggregation(aggRequestOnView); auto resolvedAggCmd = @@ -240,8 +243,11 @@ public: auto aggCmdOnViewObj = OpMsgRequest::fromDBAndBody(nss.db(), aggCmdOnView.getValue()).body; - auto aggRequestOnView = - aggregation_request_helper::parseFromBSON(nss, aggCmdOnViewObj, verbosity); + auto aggRequestOnView = aggregation_request_helper::parseFromBSON( + nss, + aggCmdOnViewObj, + verbosity, + APIParameters::get(opCtx).getAPIStrict().value_or(false)); if (!aggRequestOnView.isOK()) { return aggRequestOnView.getStatus(); } diff --git a/src/mongo/s/commands/cluster_distinct_cmd.cpp b/src/mongo/s/commands/cluster_distinct_cmd.cpp index e6167129a67..7d1e5bc7c0b 100644 --- a/src/mongo/s/commands/cluster_distinct_cmd.cpp +++ b/src/mongo/s/commands/cluster_distinct_cmd.cpp @@ -133,8 +133,11 @@ public: } auto viewAggCmd = OpMsgRequest::fromDBAndBody(nss.db(), aggCmdOnView.getValue()).body; - auto aggRequestOnView = - aggregation_request_helper::parseFromBSON(nss, viewAggCmd, verbosity); + auto aggRequestOnView = aggregation_request_helper::parseFromBSON( + nss, + viewAggCmd, + verbosity, + APIParameters::get(opCtx).getAPIStrict().value_or(false)); if (!aggRequestOnView.isOK()) { return aggRequestOnView.getStatus(); } @@ -208,7 +211,11 @@ public: uassertStatusOK(aggCmdOnView.getStatus()); auto viewAggCmd = OpMsgRequest::fromDBAndBody(nss.db(), aggCmdOnView.getValue()).body; - auto aggRequestOnView = aggregation_request_helper::parseFromBSON(nss, viewAggCmd); + auto aggRequestOnView = aggregation_request_helper::parseFromBSON( + nss, + viewAggCmd, + boost::none, + APIParameters::get(opCtx).getAPIStrict().value_or(false)); uassertStatusOK(aggRequestOnView.getStatus()); auto resolvedAggRequest = ex->asExpandedViewAggregation(aggRequestOnView.getValue()); diff --git a/src/mongo/s/commands/cluster_find_cmd.cpp b/src/mongo/s/commands/cluster_find_cmd.cpp index dbfd1d539ef..813bee06bad 100644 --- a/src/mongo/s/commands/cluster_find_cmd.cpp +++ b/src/mongo/s/commands/cluster_find_cmd.cpp @@ -61,7 +61,11 @@ std::unique_ptr<QueryRequest> parseCmdObjectToQueryRequest(OperationContext* opC NamespaceString nss, BSONObj cmdObj, bool isExplain) { - auto qr = QueryRequest::makeFromFindCommand(std::move(cmdObj), isExplain, std::move(nss)); + auto qr = + QueryRequest::makeFromFindCommand(std::move(cmdObj), + isExplain, + std::move(nss), + APIParameters::get(opCtx).getAPIStrict().value_or(false)); if (!qr->getReadConcern()) { if (opCtx->isStartingMultiDocumentTransaction() || !opCtx->inMultiDocumentTransaction()) { // If there is no explicit readConcern in the cmdObj, and this is either the first @@ -195,7 +199,10 @@ public: OpMsgRequest::fromDBAndBody(_dbName, aggCmdOnView).body; auto aggRequestOnView = uassertStatusOK(aggregation_request_helper::parseFromBSON( - ns(), viewAggregationCommand, verbosity)); + ns(), + viewAggregationCommand, + verbosity, + 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. @@ -257,8 +264,11 @@ public: auto viewAggregationCommand = OpMsgRequest::fromDBAndBody(_dbName, aggCmdOnView).body; - auto aggRequestOnView = uassertStatusOK( - aggregation_request_helper::parseFromBSON(ns(), viewAggregationCommand)); + auto aggRequestOnView = uassertStatusOK(aggregation_request_helper::parseFromBSON( + ns(), + viewAggregationCommand, + boost::none, + 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 631a5dabcc0..8568a46d9aa 100644 --- a/src/mongo/s/commands/cluster_pipeline_cmd.cpp +++ b/src/mongo/s/commands/cluster_pipeline_cmd.cpp @@ -74,7 +74,10 @@ public: const OpMsgRequest& opMsgRequest, boost::optional<ExplainOptions::Verbosity> explainVerbosity) override { const auto aggregationRequest = uassertStatusOK(aggregation_request_helper::parseFromBSON( - opMsgRequest.getDatabase().toString(), opMsgRequest.body, explainVerbosity)); + opMsgRequest.getDatabase().toString(), + opMsgRequest.body, + explainVerbosity, + APIParameters::get(opCtx).getAPIStrict().value_or(false))); auto privileges = uassertStatusOK(AuthorizationSession::get(opCtx->getClient()) diff --git a/src/mongo/s/commands/strategy.cpp b/src/mongo/s/commands/strategy.cpp index 5b4ccd3a82d..8a167a09548 100644 --- a/src/mongo/s/commands/strategy.cpp +++ b/src/mongo/s/commands/strategy.cpp @@ -508,8 +508,8 @@ Status ParseAndRunCommand::_prologue() { uassert(ErrorCodes::InvalidOptions, "no such command option $maxTimeMs; use maxTimeMS instead", request.body[QueryRequest::queryOptionMaxTimeMS].eoo()); - const int maxTimeMS = uassertStatusOK( - QueryRequest::parseMaxTimeMS(request.body[QueryRequest::cmdOptionMaxTimeMS])); + const int maxTimeMS = + uassertStatusOK(parseMaxTimeMS(request.body[QueryRequest::cmdOptionMaxTimeMS])); if (maxTimeMS > 0 && command->getLogicalOp() != LogicalOp::opGetMore) { opCtx->setDeadlineAfterNowBy(Milliseconds{maxTimeMS}, ErrorCodes::MaxTimeMSExpired); } |