diff options
author | Kyle Suarez <kyle.suarez@mongodb.com> | 2022-05-16 19:56:40 +0000 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2022-05-16 20:19:29 +0000 |
commit | 5cc18bcd682fc59cd3714800a69f34246049caee (patch) | |
tree | 73267de7f272f6b8fe9f4b906f685010159f8d42 /src/mongo | |
parent | 04e49a5d48ac6e9486f196806efae1ed11d79948 (diff) | |
download | mongo-5cc18bcd682fc59cd3714800a69f34246049caee.tar.gz |
SERVER-65859 Enable filtering of 'fromMigrate' change steam events for individual operations within applyOps array
Diffstat (limited to 'src/mongo')
-rw-r--r-- | src/mongo/db/pipeline/document_source_change_stream_unwind_transaction.cpp | 7 |
1 files changed, 7 insertions, 0 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 40603a0b1d7..05bfcff4df7 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 @@ -63,6 +63,13 @@ std::unique_ptr<MatchExpression> buildUnwindTransactionFilter( // filtered out by the default 'ns' filter this stage gets initialized with. auto unwindFilter = std::make_unique<AndMatchExpression>(buildOperationFilter(expCtx, nullptr)); + // To correctly handle filtering out entries of direct write operations on orphaned documents, + // we include a filter for "fromMigrate" flagged operations, unless "fromMigrate" events are + // explicitly requested in the spec. + if (!expCtx->changeStreamSpec->getShowMigrationEvents()) { + unwindFilter->add(buildNotFromMigrateFilter(expCtx, userMatch)); + } + // Attempt to rewrite the user's filter and combine it with the standard operation filter. We do // this separately because we need to exclude certain fields from the user's filters. Unwound // transaction events do not have these fields until we populate them from the commitTransaction |