summaryrefslogtreecommitdiff
path: root/src/mongo/db/storage/index_entry_comparison.cpp
diff options
context:
space:
mode:
authorLouis Williams <louis.williams@mongodb.com>2021-04-07 09:21:31 -0400
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2021-04-07 13:54:07 +0000
commit8cdac63ac18aa2e852d7450885fef71113ff0464 (patch)
tree77ff15a3be0cf41c1c33b864b02a1a7f8446d12b /src/mongo/db/storage/index_entry_comparison.cpp
parent73abf8b8a5ea0faec28b261ebaf589c29cd56593 (diff)
downloadmongo-8cdac63ac18aa2e852d7450885fef71113ff0464.tar.gz
SERVER-55342 Clustered collections should reject duplicate _id values
The WiredTigerSessionCache should not mix cursors with different overwrite settings.
Diffstat (limited to 'src/mongo/db/storage/index_entry_comparison.cpp')
-rw-r--r--src/mongo/db/storage/index_entry_comparison.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/mongo/db/storage/index_entry_comparison.cpp b/src/mongo/db/storage/index_entry_comparison.cpp
index 965a4e8d796..f609ca07f0b 100644
--- a/src/mongo/db/storage/index_entry_comparison.cpp
+++ b/src/mongo/db/storage/index_entry_comparison.cpp
@@ -194,7 +194,10 @@ Status buildDupKeyErrorStatus(const BSONObj& key,
StringBuilder sb;
sb << "E11000 duplicate key error";
sb << " collection: " << collectionNamespace;
- sb << " index: " << indexName;
+ if (indexName.size()) {
+ // This helper may be used for clustered collections when there is no _id index.
+ sb << " index: " << indexName;
+ }
if (hasCollation) {
sb << " collation: " << indexCollation;
}