summaryrefslogtreecommitdiff
path: root/src/mongo/db/s/metadata_manager.cpp
diff options
context:
space:
mode:
authorNathan Myers <nathan.myers@10gen.com>2017-09-25 16:20:23 -0400
committerNathan Myers <nathan.myers@10gen.com>2017-09-25 16:20:23 -0400
commit0939e1447aa5b4291c09c1fab2344a66098213dd (patch)
tree53675734d2c5d1378088beb3b35c77cce8ed7a15 /src/mongo/db/s/metadata_manager.cpp
parentd7aca6435e8ccc89005a97dc585dfbe429a17dec (diff)
downloadmongo-0939e1447aa5b4291c09c1fab2344a66098213dd.tar.gz
SERVER-29136 Plumb update document key through to op log
Diffstat (limited to 'src/mongo/db/s/metadata_manager.cpp')
-rw-r--r--src/mongo/db/s/metadata_manager.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/mongo/db/s/metadata_manager.cpp b/src/mongo/db/s/metadata_manager.cpp
index c7d5c74052e..9e4e2efd88c 100644
--- a/src/mongo/db/s/metadata_manager.cpp
+++ b/src/mongo/db/s/metadata_manager.cpp
@@ -293,7 +293,8 @@ BSONObj ScopedCollectionMetadata::extractDocumentKey(BSONObj const& doc) const {
if (auto id = doc["_id"_sd]) {
return key.isEmpty() ? id.wrap() : BSONObjBuilder(std::move(key)).append(id).obj();
}
- return key;
+ // For legacy documents that lack an _id, use the document itself as its key.
+ return doc;
}
ScopedCollectionMetadata::~ScopedCollectionMetadata() {