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

Change updates to prefer target by the query

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 4.1.12
    • Affects Version/s: None
    • Component/s: Querying, Sharding
    • Labels:
      None
    • Minor Change
    • ALL
    • Query 2019-04-08, Query 2019-04-22, Query 2019-05-06, Query 2019-05-20, Query 2019-06-03

      Currently, replacement style updates target using the update rather than the query. We should change this to target using the query instead.

      As of today, we do not allow users to change the shard key for a document. If shard 1 owns the chunk with range (shardKey : min, shardKey : 500) and shard 2 owns the chunk with range (shardKey : 500, shardKey : max) and a user sends

      db.coll.update({shardKey : 100}, {shardKey : 800})

      the update will be sent to shard 2 and we return

      {ok: 1.0, nMatched : 0)

      We should actually get an ImmutableField error.

      Once we allow a user to update the shard key for a document (PM-1163), the above update should cause the document to change shards. However, since the update would be sent to shard 2, shard 1 will never actually see this update and the update will not be applied.

            Assignee:
            arun.banala@mongodb.com Arun Banala
            Reporter:
            janna.golden@mongodb.com Janna Golden
            Votes:
            0 Vote for this issue
            Watchers:
            9 Start watching this issue

              Created:
              Updated:
              Resolved: