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

Writes without shard key doesn't work with constants defined in 'let'

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 7.2.0-rc0
    • Affects Version/s: None
    • Component/s: None
    • None
    • Fully Compatible
    • ALL
    • v7.1
    • Hide

      For update: change the cmdObj for this test case to

      cmdObj: {
                  update: collName,
                  updates: [{q: {$expr: {$eq: ["$y", "$$myVal"]}}, u: {$set: {z: setFieldVal}}}],
                  let : {myVal: yFieldVal},
      },
      

      For delete: change the cmdObj for this test case to

      cmdObj: {
                  delete: collName,
                  deletes: [{q: {$expr: {$eq: ["$y", "$$myVal"]}}, limit: 1}],
                  let : {myVal: yFieldVal},
      },
      

      And they will fail with

      {
          "index" : 0,
          "code" : 17276,
          "errmsg" : "Write results unavailable from failing to target a host in the shard updateOne_without_shard_key_basic-rs0 :: caused by :: Use of undefined variable: myVal"
      }
      
      Show
      For update: change the cmdObj for this test case to cmdObj: { update: collName, updates: [{q: {$expr: {$eq: ["$y", "$$myVal"]}}, u: {$set: {z: setFieldVal}}}], let : {myVal: yFieldVal}, }, For delete: change the cmdObj for this test case to cmdObj: { delete: collName, deletes: [{q: {$expr: {$eq: ["$y", "$$myVal"]}}, limit: 1}], let : {myVal: yFieldVal}, }, And they will fail with { "index" : 0, "code" : 17276, "errmsg" : "Write results unavailable from failing to target a host in the shard updateOne_without_shard_key_basic-rs0 :: caused by :: Use of undefined variable: myVal" }
    • Sharding NYC 2023-09-18, Sharding NYC 2023-10-02, Sharding NYC 2023-10-16

            Assignee:
            jason.zhang@mongodb.com Jason Zhang (Inactive)
            Reporter:
            lingzhi.deng@mongodb.com Lingzhi Deng
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: