diff options
Diffstat (limited to 'src/mongo/db/pipeline/document_source_change_stream.h')
-rw-r--r-- | src/mongo/db/pipeline/document_source_change_stream.h | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/src/mongo/db/pipeline/document_source_change_stream.h b/src/mongo/db/pipeline/document_source_change_stream.h index d3492b0c319..8f8ef6f6e79 100644 --- a/src/mongo/db/pipeline/document_source_change_stream.h +++ b/src/mongo/db/pipeline/document_source_change_stream.h @@ -80,15 +80,13 @@ public: } } - void assertSupportsReadConcern(const repl::ReadConcernArgs& readConcern) const { - // Only "majority" is allowed for change streams. - uassert( - ErrorCodes::InvalidOptions, - str::stream() - << "$changeStream cannot run with a readConcern other than 'majority'. Current " - << "readConcern: " << readConcern.toString(), - !readConcern.hasLevel() || - readConcern.getLevel() == repl::ReadConcernLevel::kMajorityReadConcern); + ReadConcernSupportResult supportsReadConcern(repl::ReadConcernLevel level) const { + // Change streams require "majority" readConcern. If the client did not specify an + // explicit readConcern, change streams will internally upconvert the readConcern to + // majority (so clients can always send aggregations without readConcern). We therefore + // do not permit the cluster-wide default to be applied. + return onlySingleReadConcernSupported( + kStageName, repl::ReadConcernLevel::kMajorityReadConcern, level); } void assertSupportsMultiDocumentTransaction() const { |