summaryrefslogtreecommitdiff
path: root/src/mongo/db/pipeline/document_internal.h
diff options
context:
space:
mode:
authorDavid Storch <david.storch@mongodb.com>2019-09-12 21:31:40 +0000
committerevergreen <evergreen@mongodb.com>2019-09-12 21:31:40 +0000
commit9e98a74e5f206bf28f598c7e94a4e3901c7a1bd7 (patch)
tree8de7ef2fcb2eca439a49af570998f637761bebe8 /src/mongo/db/pipeline/document_internal.h
parente3a8d37b8775d90f85cb64f3630cb547a886baa1 (diff)
downloadmongo-9e98a74e5f206bf28f598c7e94a4e3901c7a1bd7.tar.gz
SERVER-42981 Make WorkingSetMember compatible for use with the Sorter.
The bulk of this change is to implement serialization and deserialization routines for WorkingSetMember, so that the Sorter can spill WorkingSetMembers to disk. In addition, this changes the SortExecutor to sort WorkingSetMembers internally as opposed to sorting Documents.
Diffstat (limited to 'src/mongo/db/pipeline/document_internal.h')
-rw-r--r--src/mongo/db/pipeline/document_internal.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/mongo/db/pipeline/document_internal.h b/src/mongo/db/pipeline/document_internal.h
index 28417a6a46a..d521fa5aec7 100644
--- a/src/mongo/db/pipeline/document_internal.h
+++ b/src/mongo/db/pipeline/document_internal.h
@@ -422,6 +422,7 @@ public:
}
DocumentMetadataFields releaseMetadata() {
+ loadLazyMetadata();
return std::move(_metadataFields);
}
@@ -533,6 +534,11 @@ private:
BSONObj _bson;
mutable BSONObjIterator _bsonIt;
+ // If '_stripMetadata' is true, tracks whether or not the metadata has been lazy-loaded from the
+ // backing '_bson' object. If so, then no attempt will be made to load the metadata again, even
+ // if the metadata has been released by a call to 'releaseMetadata()'.
+ mutable bool _haveLazyLoadedMetadata = false;
+
mutable DocumentMetadataFields _metadataFields;
// The storage constructed from a BSON value may contain metadata. When we process the BSON we