summaryrefslogtreecommitdiff
path: root/src/mongo/db/catalog/clustered_collection_util.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/mongo/db/catalog/clustered_collection_util.cpp')
-rw-r--r--src/mongo/db/catalog/clustered_collection_util.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/mongo/db/catalog/clustered_collection_util.cpp b/src/mongo/db/catalog/clustered_collection_util.cpp
index 65a589c38ba..88c1ed92f42 100644
--- a/src/mongo/db/catalog/clustered_collection_util.cpp
+++ b/src/mongo/db/catalog/clustered_collection_util.cpp
@@ -118,14 +118,15 @@ BSONObj formatClusterKeyForListIndexes(const ClusteredCollectionInfo& collInfo)
bool isClusteredOnId(const boost::optional<ClusteredCollectionInfo>& collInfo) {
- if (!collInfo) {
- return false;
- }
return clustered_util::matchesClusterKey(BSON("_id" << 1), collInfo);
}
bool matchesClusterKey(const BSONObj& obj,
const boost::optional<ClusteredCollectionInfo>& collInfo) {
+ if (!collInfo) {
+ return false;
+ }
+
const auto nFields = obj.nFields();
invariant(nFields > 0);
if (nFields > 1) {