summaryrefslogtreecommitdiff
path: root/src/mongo/db/commands/run_aggregate.cpp
diff options
context:
space:
mode:
authorGil Alon <gil.alon@mongodb.com>2023-02-23 19:51:02 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2023-02-24 00:41:37 +0000
commitaedd17378dd25615c4337b2a8c02687e0e3d2f70 (patch)
tree713fa6b87dc83d1b28692b9b8741cb8164726bd9 /src/mongo/db/commands/run_aggregate.cpp
parent248888231318f0423bf78234d2f120585f4fdd6a (diff)
downloadmongo-aedd17378dd25615c4337b2a8c02687e0e3d2f70.tar.gz
SERVER-72687 Add support for $out to timeseries collection
Diffstat (limited to 'src/mongo/db/commands/run_aggregate.cpp')
-rw-r--r--src/mongo/db/commands/run_aggregate.cpp11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/mongo/db/commands/run_aggregate.cpp b/src/mongo/db/commands/run_aggregate.cpp
index 743ed39f194..d0bd10e4e71 100644
--- a/src/mongo/db/commands/run_aggregate.cpp
+++ b/src/mongo/db/commands/run_aggregate.cpp
@@ -920,10 +920,13 @@ Status runAggregate(OperationContext* opCtx,
// Set this operation's shard version for the underlying collection to unsharded.
// This is prerequisite for future shard versioning checks.
- ScopedSetShardRole scopedSetShardRole(opCtx,
- resolvedView.getNamespace(),
- ShardVersion::UNSHARDED() /* shardVersion */,
- boost::none /* databaseVersion */);
+ boost::optional<ScopedSetShardRole> scopeSetShardRole;
+ if (serverGlobalParams.clusterRole != ClusterRole::None) {
+ scopeSetShardRole.emplace(opCtx,
+ resolvedView.getNamespace(),
+ ShardVersion::UNSHARDED() /* shardVersion */,
+ boost::none /* databaseVersion */);
+ }
uassert(std::move(resolvedView),
"Explain of a resolved view must be executed by mongos",