diff options
-rw-r--r-- | src/mongo/db/storage/wiredtiger/wiredtiger_index.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/mongo/db/storage/wiredtiger/wiredtiger_index.cpp b/src/mongo/db/storage/wiredtiger/wiredtiger_index.cpp index 8cfbac8622e..45f3f028766 100644 --- a/src/mongo/db/storage/wiredtiger/wiredtiger_index.cpp +++ b/src/mongo/db/storage/wiredtiger/wiredtiger_index.cpp @@ -1163,9 +1163,10 @@ protected: // and timestamp unsafe unique indexes. The contract of this function is to always return a // KeyString with a RecordId, so append one if it does not exists already. if (_idx.unique() && - _key.getSize() == - KeyString::getKeySize( - _key.getBuffer(), _key.getSize(), _idx.getOrdering(), _typeBits)) { + (_idx.isIdIndex() || + _key.getSize() == + KeyString::getKeySize( + _key.getBuffer(), _key.getSize(), _idx.getOrdering(), _typeBits))) { // Create a copy of _key with a RecordId. Because _key is used during cursor restore(), // appending the RecordId would cause the cursor to be repositioned incorrectly. KeyString::Builder keyWithRecordId(_key); |