diff options
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.cpp | 3 |
1 files changed, 1 insertions, 2 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 33c32f096b3..39a13272df6 100644 --- a/src/mongo/db/pipeline/document_source_sequential_document_cache.cpp +++ b/src/mongo/db/pipeline/document_source_sequential_document_cache.cpp @@ -41,7 +41,6 @@ DocumentSourceSequentialDocumentCache::DocumentSourceSequentialDocumentCache( const boost::intrusive_ptr<ExpressionContext>& expCtx, SequentialDocumentCache* cache) : DocumentSource(kStageName, expCtx), _cache(cache) { invariant(_cache); - invariant(!_cache->isAbandoned()); if (_cache->isServing()) { _cache->restartIteration(); @@ -96,7 +95,7 @@ Pipeline::SourceContainer::iterator DocumentSourceSequentialDocumentCache::doOpt _hasOptimizedPos = true; // If the cache is the only stage in the pipeline, return immediately. - if (itr == container->begin()) { + if (itr == container->begin() && std::next(itr) == container->end()) { return container->end(); } |
