repro:
./mongod --replSet foo
in mongoshell:
> rs.initiate()
{
"info2" : "no configuration explicitly specified -- making one",
"me" : "dannenberg-air.local:27017",
"info" : "Config now saved locally. Should come online in about a minute.",
"ok" : 1
}
foo:PRIMARY> db.foo.find()
{ "_id" : 1, "a" : 1, "b" : 31 }
{ "_id" : 2, "a" : 73, "b" : 481 }
{ "_id" : 3, "a" : 26, "b" : 974 }
foo:PRIMARY> db.foo.update({_id: {$gt:0}}, {$max:{'b':456}, $mul:{'a':3}}, {multi:true})
SingleWriteResult({
"writeErrors" : [ ],
"writeConcernErrors" : [ ],
"nInserted" : 0,
"nUpserted" : 0,
"nUpdated" : 3,
"nModified" : 3,
"nRemoved" : 0,
"upserted" : [ ]
})
foo:PRIMARY> db.foo.find()
{ "_id" : 1, "a" : 3, "b" : 456 }
{ "_id" : 2, "a" : 219, "b" : 481 }
{ "_id" : 3, "a" : 78, "b" : 974 }
foo:PRIMARY> use local
foo:PRIMARY> db.oplog.rs.find()
{ "ts" : Timestamp(1391619547, 1), "h" : NumberLong(0), "v" : 2, "op" : "n", "ns" : "", "o" : { "msg" : "initiating set" } }
{ "ts" : Timestamp(1391619586, 1), "h" : NumberLong("-9072134066425298927"), "v" : 2, "op" : "u", "ns" : "test.foo", "o2" : { "_id" : 1 }, "o" : { "$set" : { "b" : 456, "a" : 3 } } }
{ "ts" : Timestamp(1391619586, 2), "h" : NumberLong("4916804790102561797"), "v" : 2, "op" : "u", "ns" : "test.foo", "o2" : { "_id" : 2 }, "o" : { "$set" : { "b" : 456, "a" : 219 } } }
{ "ts" : Timestamp(1391619586, 3), "h" : NumberLong("1732897782215714738"), "v" : 2, "op" : "u", "ns" : "test.foo", "o2" : { "_id" : 3 }, "o" : { "$set" : { "b" : 456, "a" : 78 } } }
as you can see, the updates apply properly, but the oplog entries say to modify b even where it wasnt modified, which will lead to be bad info on the secondaries