diff options
author | Rishab Joshi <rishab.joshi@mongodb.com> | 2021-08-24 17:39:06 +0000 |
---|---|---|
committer | Rishab Joshi <rishab.joshi@mongodb.com> | 2021-08-24 17:39:06 +0000 |
commit | e15a429d9c1c2c6d5fe5d186b866ae7d8e7c6e60 (patch) | |
tree | 8ae0ebcbea81eedcc908fbabbcb2f0e9fed1bf59 | |
parent | efd77f1ed9fd44b9422f1855f7d46ad18de69a1a (diff) | |
download | mongo-e15a429d9c1c2c6d5fe5d186b866ae7d8e7c6e60.tar.gz |
SERVER-58857 Do not filter 'fromMigrate' events if 'showMigrationEvents' option has been specified.
-rw-r--r-- | src/mongo/db/pipeline/document_source_change_stream_oplog_match.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/mongo/db/pipeline/document_source_change_stream_oplog_match.cpp b/src/mongo/db/pipeline/document_source_change_stream_oplog_match.cpp index c258eca5896..a811ba3f653 100644 --- a/src/mongo/db/pipeline/document_source_change_stream_oplog_match.cpp +++ b/src/mongo/db/pipeline/document_source_change_stream_oplog_match.cpp @@ -190,9 +190,12 @@ BSONObj buildMatchFilter(const boost::intrusive_ptr<ExpressionContext>& expCtx, // 3) Look for 'applyOps' which were created as part of a transaction. BSONObj applyOps = getTxnApplyOpsFilter(opNsMatch["ns"], nss); - // Either (1) or (3), excluding those resulting from chunk migration. + // Exclude 'fromMigrate' events if 'showMigrationEvents' has not been specified as $changeStream + // option. BSONObj commandAndApplyOpsMatch = - BSON("$and" << BSON_ARRAY(BSON(OR(commandMatch, applyOps)) << notFromMigrateFilter)); + (showMigrationEvents ? BSON(OR(commandMatch, applyOps)) + : BSON("$and" << BSON_ARRAY(BSON(OR(commandMatch, applyOps)) + << notFromMigrateFilter))); // Match oplog entries after "start" that are either supported (1) commands or (2) operations. // Only include CRUD operations tagged "fromMigrate" when the "showMigrationEvents" option is |