Version 2.6.3 of mongod:
While updating a subdocument rank that is part of contact that is part of user:
This is a MOPED log:
MOPED: 127.0.0.1:27017 UPDATE database=ran_q_test collection=users selector=
update={"$set"=>{"contacts.0.contact_ranks.$.value"=>100}} flags=[]
COMMAND database=ran_q_test command={:getlasterror=>1, :w=>1} runtime: 2.5676ms
MOPED: 127.0.0.1:27017 UPDATE database=ran_q_test collection=users selector=
update={"$set"=>{"contacts.0.contact_ranks.$.value"=>200}} flags=[]
COMMAND database=ran_q_test command={:getlasterror=>1, :w=>1} runtime: 2.3991ms
MOPED: 127.0.0.1:27017 UPDATE database=ran_q_test collection=users selector=
update={"$set"=>{"contacts.0.contact_ranks.$.value"=>300}} flags=[]
COMMAND database=ran_q_test command={:getlasterror=>1, :w=>1} runtime: 2.3387ms
MOPED: 127.0.0.1:27017 UPDATE database=ran_q_test collection=users selector=
update={"$set"=>{"contacts.0.contact_ranks.$.value"=>400}} flags=[]
COMMAND database=ran_q_test command={:getlasterror=>1, :w=>1} runtime: 2.1929ms
MOPED: 127.0.0.1:27017 UPDATE database=ran_q_test collection=users selector=
update={"$set"=>{"contacts.0.contact_ranks.$.value"=>500}} flags=[]
COMMAND database=ran_q_test command={:getlasterror=>1, :w=>1} runtime: 2.2453ms
MOPED: 127.0.0.1:27017 UPDATE database=ran_q_test collection=users selector=
update={"$set"=>{"contacts.0.contact_ranks.$.value"=>600}} flags=[]
COMMAND database=ran_q_test command={:getlasterror=>1, :w=>1} runtime: 2.2785ms
But seems that instead of updating each document it updates always the first one. The result:
> ranks = db.users.find()[0].contacts[0].contact_ranks
[
,
,
,
,
,
{ "_id" : ObjectId("54a179a162656e40ac070000"), "_type" : "ContactRank", "name" : "angry" }]
In 2.4.12 it works just fine, and the result as it should be:
> ranks = db.users.find()[0].contacts[0].contact_ranks
[
,
,
,
,
,
{ "_id" : ObjectId("54a17b2362656e461c070000"), "_type" : "ContactRank", "name" : "angry", "value" : 600 }]
I think it is a very serious bug, please reply urgently.
Kind regards, Benjamin Harel.