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

Update may result in doc without shard key

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Critical - P2 Critical - P2
    • 2.4.0-rc0
    • Affects Version/s: None
    • Component/s: Sharding
    • Labels:
      None
    • ALL

      If you include the shard-key in the query, but it is removed in the update operations, then the resulting inserted document will not contain the shard key, and will be lost to the sharded system queries.

      Mongos should probably build the possibly inserted document to verify the shard-key exists in it before sending the update to the shard.

      Take these examples

      > db.s.update({shardkey:1}, {$unset: {shardkey:1}, $set: {otherfield : 5}}, true)
      // other example
      > db.s2.update({"embedded.key":1}, {$set : {embedded:{not_key:1}}}, true)
      

            Assignee:
            alerner Alberto Lerner
            Reporter:
            scotthernandez Scott Hernandez (Inactive)
            Votes:
            1 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: