diff options
-rw-r--r-- | src/mongo/db/pipeline/change_stream_filter_helpers.cpp | 10 | ||||
-rw-r--r-- | src/mongo/db/pipeline/change_stream_rewrite_helpers.cpp | 7 |
2 files changed, 12 insertions, 5 deletions
diff --git a/src/mongo/db/pipeline/change_stream_filter_helpers.cpp b/src/mongo/db/pipeline/change_stream_filter_helpers.cpp index c24d834f6ec..125d43c9dab 100644 --- a/src/mongo/db/pipeline/change_stream_filter_helpers.cpp +++ b/src/mongo/db/pipeline/change_stream_filter_helpers.cpp @@ -62,11 +62,11 @@ std::unique_ptr<MatchExpression> buildOperationFilter( auto streamType = DocumentSourceChangeStream::getChangeStreamType(expCtx->ns); /** - * IMPORTANT: Any new operationType added here must also have a corresponding rewrite in both - * the 'exprRewriteOperationType' and 'matchRewriteOperationType' functions, which can be found - * in the file change_stream_rewrite_helpers.cpp. Without a corresponding rewrite, the optimizer - * will assume that no event can pass a $match filter on the newly added operationType, causing - * it to erroneously discard events. + * IMPORTANT: Any new operationType added here must also add corresponding oplog rewrites in the + * file change_stream_rewrite_helpers.cpp. A number of the existing rewrite functions in that + * file rely upon an exhaustive list of all change stream events that are derived directly from + * the oplog. Without appropriate rewrite rules for the new event, the optimizer will assume + * that no oplog entry can ever match the user's filter, causing it to discard those events. */ // The standard event filter, before it is combined with the user filter, is as follows: diff --git a/src/mongo/db/pipeline/change_stream_rewrite_helpers.cpp b/src/mongo/db/pipeline/change_stream_rewrite_helpers.cpp index c7c0231e252..f48ba981d8c 100644 --- a/src/mongo/db/pipeline/change_stream_rewrite_helpers.cpp +++ b/src/mongo/db/pipeline/change_stream_rewrite_helpers.cpp @@ -845,6 +845,13 @@ std::unique_ptr<MatchExpression> matchRewriteNs( str::stream() << "Unexpected predicate on " << predicate->path(), predicate->fieldRef()->getPart(0) == DocumentSourceChangeStream::kNamespaceField); + /** + * NOTE: the list below MUST be kept up-to-date with any newly-added user-facing change stream + * opTypes that are derived from oplog events (as opposed to events which are generated by + * change stream stages themselves). Internal events of type {op: 'n'} are handled separately + * and do not need to be considered here. + */ + // // CRUD events // |