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

Able to modify component of shard key

    • Type: Icon: Bug Bug
    • Resolution: Duplicate
    • Priority: Icon: Critical - P2 Critical - P2
    • None
    • Affects Version/s: 2.4.0-rc1
    • Component/s: Sharding
    • None
    • Environment:
      2.4.0-rc1 build on Windows 7
    • ALL
    • Hide

      mongo ShardKeyModify.js

      Show
      mongo ShardKeyModify.js

      The test below fails with
      assert: [null] != [null] are equal : undefined
      Error: Printing Stack Trace
      at printStackTrace (src/mongo/shell/utils.js:37:7)
      at doassert (src/mongo/shell/assert.js:6:1)
      at Function.assert.neq (src/mongo/shell/assert.js:44:1)
      at c:\Users\sridhar\Desktop\ShardKeyModify.js:54:8

      Expect the document to be unchanged
      { "_id" : -1, "ckey" :

      { "key1" : -1, "key2" : -1 }

      , "val" : -1 }
      Instead the update goes through resulting in
      { "_id" : -1, "ckey" :

      { "key1" : -1, "key2" : -101 }

      , "val" : -101 }

      Similarly the following change should not go through
      coll2Sh.update({ckey:{key1:-2, key2:-2}},{$set:{'ckey.key2':-100, val:-100}})
      So instead of the document remaining unchanged as
      { "_id" : -2, "ckey" :

      { "key1" : -2, "key2" : -2 }

      , "val" : -2 }
      it is updated to
      { "_id" : -2, "ckey" :

      { "key1" : -2, "key2" : -100 }

      , "val" : -100 }

      But as expected the following results in an error
      coll2Sh.update({ckey:{key1:-3, key2:-3}},{$set:{ckey:

      {key1:-300,key2:-300}

      , val:-100}})
      Can't modify shard key's value. field: ckey:

      { key1: -300.0, key2: -300.0 }

      collection: _unknown_name_.coll2Sharded

        1. ShardKeyModify.js
          1 kB
          Sridhar Nanjundeswaran

            Assignee:
            Unassigned Unassigned
            Reporter:
            sridhar Sridhar Nanjundeswaran
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: