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

$merge fails when session default read concern has been set to "majority"

    • Fully Compatible
    • ALL
    • v7.0, v6.0, v5.0, v4.4
    • QO 2022-08-22, QO 2022-09-19, QO 2022-10-03, QE 2022-10-17
    • 162

       Hi team,

      User-visible impact as reported by the user (what is the user seeing):

      The same aggregation with $merge works on a RS, but fails on a sharded cluster with error

       

      MongoServerError: Command listIndexes does not support { readConcern: { level: "majority", provenance: "customDefault" } } :: caused by :: read concern not supported
      

      MongoDB Version and Architecture:

      Tested on v4.4.16 and v5.0.11 and v6.0.1

      Steps to reproduce:

      On a mongos, run the following:

      use test
      db.adminCommand({ "setDefaultRWConcern": 1, "defaultReadConcern":{ level: "majority"}})
      db.test.drop()
      db.test.insertOne({ a: 1 })
      db.test.aggregate([{$merge:{ into: "coll2", on: "_id", whenMatched: "replace", whenNotMatched:"insert"}}])
      // it doesn't matter whether the collection coll2 exists or not, the command fails with the same error
      

      Expected:

      The command should succeed

      Actual result:

       

      MongoServerError: Command listIndexes does not support { readConcern: { level: "majority", provenance: "customDefault" } } :: caused by :: read concern not supported
      

      Note:

      This issue does not happen on a RS.

      The command would also succeed if the $merge stage only contains the collection name: {$merge:"coll2"}

      Prioritized questions for the Server Team:

      Please help confirm if this is a bug.

            Assignee:
            jess.balint@mongodb.com Jess Balint
            Reporter:
            jess.balint@mongodb.com Jess Balint
            Votes:
            0 Vote for this issue
            Watchers:
            14 Start watching this issue

              Created:
              Updated:
              Resolved: