summaryrefslogtreecommitdiff
path: root/src/mongo/db/exec/document_value/document.cpp
diff options
context:
space:
mode:
authorLucas de Castro Borges <lucas@gnuabordo.com.br>2025-02-18 17:02:53 -0300
committerLucas de Castro Borges <lucas@gnuabordo.com.br>2025-02-18 17:02:53 -0300
commit959575a5ca598bf5f37fb5cebe7ed1d80d3d71f7 (patch)
treeacc8d60aedb12b70048e676e8a7349deb0010db8 /src/mongo/db/exec/document_value/document.cpp
parent76588293975fc059cf076779e4283e6ffaf8afff (diff)
New upstream version 6.0.20upstream
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);
}