summaryrefslogtreecommitdiff
path: root/src/mongo/db/s/shard_server_op_observer.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/mongo/db/s/shard_server_op_observer.cpp')
-rw-r--r--src/mongo/db/s/shard_server_op_observer.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/mongo/db/s/shard_server_op_observer.cpp b/src/mongo/db/s/shard_server_op_observer.cpp
index 4e5009c8748..f8e80658e21 100644
--- a/src/mongo/db/s/shard_server_op_observer.cpp
+++ b/src/mongo/db/s/shard_server_op_observer.cpp
@@ -468,7 +468,7 @@ void ShardServerOpObserver::onCreateCollection(OperationContext* opCtx,
// sharded or unsharded and set it on the CSR. If this method is called with the metadata as
// UNKNOWN, this means an internal collection creation, which can only be UNSHARDED
auto* csr = CollectionShardingRuntime::get(opCtx, collectionName);
- if (!csr->getCurrentMetadataIfKnown())
+ if (opCtx->writesAreReplicated() && !csr->getCurrentMetadataIfKnown())
csr->setFilteringMetadata(opCtx, CollectionMetadata());
}