Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-46913

Disable majority read concern in change stream failed

    • Type: Icon: Improvement Improvement
    • Resolution: Community Answered
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: 4.2.3
    • Component/s: Querying
    • None
    • Server Triage
    • Fully Compatible

      In thisĀ change stream post, the read concern majority option can be disabled in v4.2. So I try to use "read concern=local" to build the change stream in golang but failed:

      (InvalidOptions) $changeStream cannot run with a readConcern other than 'majority', or in a multi-document transaction. Current readConcern: { readConcern: { level: "local" } }
      

      Here is the mongodb source code in document_source_change_stream.h

              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', or in a multi-document transaction. Current "
                                           "readConcern: "
                                        << readConcern.toString(),
                          !readConcern.hasLevel() ||
                              readConcern.getLevel() == repl::ReadConcernLevel::kMajorityReadConcern);
              }
      

      It looks like the majority read concern is not disabled.

            Assignee:
            backlog-server-triage [HELP ONLY] Backlog - Triage Team
            Reporter:
            cvinllen@gmail.com vinllen chen
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: