summaryrefslogtreecommitdiff
path: root/src/mongo/db/pipeline/document_source_sample.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/mongo/db/pipeline/document_source_sample.cpp')
-rw-r--r--src/mongo/db/pipeline/document_source_sample.cpp8
1 files changed, 3 insertions, 5 deletions
diff --git a/src/mongo/db/pipeline/document_source_sample.cpp b/src/mongo/db/pipeline/document_source_sample.cpp
index 40d5f47e3ad..5ec204d1fa9 100644
--- a/src/mongo/db/pipeline/document_source_sample.cpp
+++ b/src/mongo/db/pipeline/document_source_sample.cpp
@@ -52,10 +52,8 @@ REGISTER_DOCUMENT_SOURCE(sample,
AllowedWithApiStrict::kAlways);
DocumentSource::GetNextResult DocumentSourceSample::doGetNext() {
- if (_size == 0) {
- pSource->dispose();
+ if (_size == 0)
return GetNextResult::makeEOF();
- }
if (!_sortStage->isPopulated()) {
// Exhaust source stage, add random metadata, and push all into sorter.
@@ -83,8 +81,8 @@ DocumentSource::GetNextResult DocumentSourceSample::doGetNext() {
return _sortStage->getNext();
}
-Value DocumentSourceSample::serialize(const SerializationOptions& opts) const {
- return Value(DOC(kStageName << DOC("size" << opts.serializeLiteral(_size))));
+Value DocumentSourceSample::serialize(boost::optional<ExplainOptions::Verbosity> explain) const {
+ return Value(DOC(kStageName << DOC("size" << _size)));
}
namespace {