|
This is has been fixed both in 3.2.3 and 3.3.2:
replset:PRIMARY> db.a.drop()
|
true
|
replset:PRIMARY> db.a.update({"_id.a":1, "_id.b":2}, {$inc:{x:1}}, {upsert:true})
|
WriteResult({
|
"nMatched" : 0,
|
"nUpserted" : 1,
|
"nModified" : 0,
|
"_id" : {
|
"a" : 1,
|
"b" : 2
|
}
|
})
|
replset:PRIMARY> db.a.find()
|
{ "_id" : { "a" : 1, "b" : 2 }, "x" : 1 }
|
replset:PRIMARY> db.a.remove({})
|
WriteResult({ "nRemoved" : 1 })
|
replset:PRIMARY> db.a.update({"_id.b":1}, {$inc:{x:1}, $setOnInsert:{"_id.a":2}}, {upsert:true})
|
WriteResult({
|
"nMatched" : 0,
|
"nUpserted" : 0,
|
"nModified" : 0,
|
"writeError" : {
|
"code" : 66,
|
"errmsg" : "After applying the update to the document {_id: { b: 1.0 } , ...}, the (immutable) field '_id' was found to have been altered to _id: { b: 1.0, a: 2.0 }"
|
}
|
})
|
replset:PRIMARY>
|
|