|
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.
|