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

update() failure when hash sharding with regex query

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Critical - P2 Critical - P2
    • 2.6.0-rc0
    • Affects Version/s: 2.4.5, 2.5.3
    • Component/s: Sharding, Write Ops
    • Labels:
      None
    • Fully Compatible
    • ALL

      In the following, permissions.bool2 should be updated from true to false, but is not.
      getLastErrorObj() shows n:0 even though the analogous find() finds the document.

      mongos> sh.shardCollection("test.bar", { "path" : "hashed" } )
      { "collectionsharded" : "test.bar", "ok" : 1 }
      mongos> db.bar.save( { path: "thisisastring", "permissions": {"bool1": false, "bool2": true, "bool3": true }} )
      mongos> db.bar.find()
      { "_id" : ObjectId("526eeb94c4eb2de8a0d7ecc7"), "path" : "thisisastring", "permissions" : { "bool1" : false, "bool2" : true, "bool3" : true } }
      mongos> db.bar.update( {path:/isa/}, {"$set":{"permissions.bool2": false}}, false, true)
      mongos> db.bar.find()
      { "_id" : ObjectId("526eeb94c4eb2de8a0d7ecc7"), "path" : "thisisastring", "permissions" : { "bool1" : false, "bool2" : true, "bool3" : true } }
      

      Note, however, that changing the shard key to e.g. path:1 or changing the query to an exact string match will make the update() work.

            Assignee:
            scotthernandez Scott Hernandez (Inactive)
            Reporter:
            duraid.madina@10gen.com Duraid Madina
            Votes:
            1 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: