summaryrefslogtreecommitdiff
path: root/src/mongo/db/exec/document_value/document.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/mongo/db/exec/document_value/document.cpp')
-rw-r--r--src/mongo/db/exec/document_value/document.cpp11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/mongo/db/exec/document_value/document.cpp b/src/mongo/db/exec/document_value/document.cpp
index 7172370e4c3..2bcb637d17b 100644
--- a/src/mongo/db/exec/document_value/document.cpp
+++ b/src/mongo/db/exec/document_value/document.cpp
@@ -255,7 +255,8 @@ Value& DocumentStorage::appendField(T field, ValueElement::Kind kind) {
append(nextCollision);
append(nameSize);
append(kind);
- field.copyTo(dest, true);
+ dest += field.copy(dest, field.size());
+ *dest++ = '\0'; // Like std::string, there is both an explicit size and final NUL byte.
// Padding for alignment handled above
#undef append
@@ -432,6 +433,12 @@ Document DocumentStorage::shred() const {
return md.freeze();
}
+void DocumentStorage::loadIntoCache() const {
+ for (DocumentStorageIterator it = iterator(); !it.atEnd(); it.advance()) {
+ it.get();
+ }
+}
+
void DocumentStorage::loadLazyMetadata() const {
if (_haveLazyLoadedMetadata) {
return;
@@ -819,7 +826,7 @@ void Document::serializeForSorter(BufBuilder& buf) const {
buf.appendNum(static_cast<int>(numElems));
for (DocumentStorageIterator it = storage().iterator(); !it.atEnd(); it.advance()) {
- buf.appendStr(it->nameSD(), /*NUL byte*/ true);
+ buf.appendCStr(it->nameSD());
it->val.serializeForSorter(buf);
}