summaryrefslogtreecommitdiff
path: root/src/mongo/db/pipeline/document_source_change_stream_unwind_transaction.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/mongo/db/pipeline/document_source_change_stream_unwind_transaction.cpp')
-rw-r--r--src/mongo/db/pipeline/document_source_change_stream_unwind_transaction.cpp26
1 files changed, 15 insertions, 11 deletions
diff --git a/src/mongo/db/pipeline/document_source_change_stream_unwind_transaction.cpp b/src/mongo/db/pipeline/document_source_change_stream_unwind_transaction.cpp
index ae65c696d65..6f4877f878c 100644
--- a/src/mongo/db/pipeline/document_source_change_stream_unwind_transaction.cpp
+++ b/src/mongo/db/pipeline/document_source_change_stream_unwind_transaction.cpp
@@ -104,7 +104,7 @@ DocumentSourceChangeStreamUnwindTransaction::createFromBson(
DocumentSourceChangeStreamUnwindTransaction::DocumentSourceChangeStreamUnwindTransaction(
const BSONObj& filter, const boost::intrusive_ptr<ExpressionContext>& expCtx)
- : DocumentSource(kStageName, expCtx) {
+ : DocumentSourceInternalChangeStreamStage(kStageName, expCtx) {
rebuild(filter);
}
@@ -126,19 +126,23 @@ StageConstraints DocumentSourceChangeStreamUnwindTransaction::constraints(
ChangeStreamRequirement::kChangeStreamStage);
}
-Value DocumentSourceChangeStreamUnwindTransaction::serialize(
- boost::optional<ExplainOptions::Verbosity> explain) const {
- tassert(5467604, "expression has not been initialized", _expression);
+Value DocumentSourceChangeStreamUnwindTransaction::doSerialize(
+ const SerializationOptions& opts) const {
+ tassert(7481400, "expression has not been initialized", _expression);
- if (explain) {
- return Value(
- DOC(DocumentSourceChangeStream::kStageName << DOC("stage"
- << "internalUnwindTransaction"_sd
- << "filter" << _filter)));
+ if (opts.verbosity) {
+ BSONObjBuilder builder;
+ builder.append("stage"_sd, "internalUnwindTransaction"_sd);
+ builder.append(DocumentSourceChangeStreamUnwindTransactionSpec::kFilterFieldName,
+ _expression->serialize(opts));
+
+ return Value(DOC(DocumentSourceChangeStream::kStageName << builder.obj()));
}
- DocumentSourceChangeStreamUnwindTransactionSpec spec(_filter);
- return Value(Document{{kStageName, Value(spec.toBSON())}});
+ // 'SerializationOptions' are not required here, since serialization for explain and query
+ // stats occur before this function call.
+ return Value(Document{
+ {kStageName, Value{DocumentSourceChangeStreamUnwindTransactionSpec{_filter}.toBSON()}}});
}
DepsTracker::State DocumentSourceChangeStreamUnwindTransaction::getDependencies(