summaryrefslogtreecommitdiff
path: root/src/mongo/db/pipeline/document_source_sequential_document_cache.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/pipeline/document_source_sequential_document_cache.cpp
parent76588293975fc059cf076779e4283e6ffaf8afff (diff)
New upstream version 6.0.20upstream
Diffstat (limited to 'src/mongo/db/pipeline/document_source_sequential_document_cache.cpp')
-rw-r--r--src/mongo/db/pipeline/document_source_sequential_document_cache.cpp15
1 files changed, 8 insertions, 7 deletions
diff --git a/src/mongo/db/pipeline/document_source_sequential_document_cache.cpp b/src/mongo/db/pipeline/document_source_sequential_document_cache.cpp
index 39a13272df6..535c3f5d2be 100644
--- a/src/mongo/db/pipeline/document_source_sequential_document_cache.cpp
+++ b/src/mongo/db/pipeline/document_source_sequential_document_cache.cpp
@@ -80,9 +80,10 @@ DocumentSource::GetNextResult DocumentSourceSequentialDocumentCache::doGetNext()
Pipeline::SourceContainer::iterator DocumentSourceSequentialDocumentCache::doOptimizeAt(
Pipeline::SourceContainer::iterator itr, Pipeline::SourceContainer* container) {
- // The DocumentSourceSequentialDocumentCache should always be the last stage in the pipeline
- // pre-optimization. By the time optimization reaches this point, all preceding stages are in
- // the final positions which they would have occupied if no cache stage was present.
+ // The DocumentSourceSequentialDocumentCache relies on all other stages in the pipeline being at
+ // the final positions which they would have occupied if no cache stage was present. This should
+ // be the case when we reach this function. The cache should always be the last stage in the
+ // pipeline pre-optimizing.
invariant(_hasOptimizedPos || std::next(itr) == container->end());
invariant((*itr).get() == this);
@@ -152,12 +153,12 @@ Pipeline::SourceContainer::iterator DocumentSourceSequentialDocumentCache::doOpt
return container->end();
}
-Value DocumentSourceSequentialDocumentCache::serialize(
- boost::optional<ExplainOptions::Verbosity> explain) const {
- if (explain) {
+Value DocumentSourceSequentialDocumentCache::serialize(const SerializationOptions& opts) const {
+ if (opts.verbosity) {
return Value(Document{
{kStageName,
- Document{{"maxSizeBytes"_sd, Value(static_cast<long long>(_cache->maxSizeBytes()))},
+ Document{{"maxSizeBytes"_sd,
+ opts.serializeLiteral(static_cast<long long>(_cache->maxSizeBytes()))},
{"status"_sd,
_cache->isBuilding()
? "kBuilding"_sd