[SERVER-11430] update() failure when hash sharding with regex query Created: 28/Oct/13  Updated: 11/Jul/16  Resolved: 04/Feb/14

Status: Closed
Project: Core Server
Component/s: Sharding, Write Ops
Affects Version/s: 2.4.5, 2.5.3
Fix Version/s: 2.6.0-rc0

Type: Bug Priority: Critical - P2
Reporter: Duraid Madina Assignee: Scott Hernandez (Inactive)
Resolution: Done Votes: 1
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Attachments: File SERVER-11430.js    
Issue Links:
Related
related to SERVER-12536 Only allow shard key types which can ... Backlog
Backwards Compatibility: Fully Compatible
Operating System: ALL
Participants:

 Description   

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.



 Comments   
Comment by Githook User [ 04/Feb/14 ]

Author:

{u'username': u'scotthernandez', u'name': u'Scott Hernandez', u'email': u'scotthernandez@gmail.com'}

Message: SERVER-11430: test to keep from regression
Branch: master
https://github.com/mongodb/mongo/commit/a51798c7d315bf111f53c5b3dd834303df5a0679

Generated at Thu Feb 08 03:25:47 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.