|
This change clarifies some edge cases in our upsert syntax, for example:
Empty collection and running against a single mongod:
db.coll.update({ _id : 1 }, { a : 1 }, { upsert : true });
|
v2.6 and v2.8 => upserted with _id : 1
|
|
db.coll.update({ _id : { $eq : 1 } }, { a : 1 }, { upsert : true });
|
v2.6 => error
|
v2.8 => upserted with _id : 1
|
|
db.coll.update({ _id.x : 1, _id.y : 2 }, { $set : { a : 1 } }, { upsert : true });
|
v2.6, v2.8 => upserted with _id : { x : 1, y : 2 }
|
|
db.coll.update({ _id.x : 1, _id.y : 2 }, { a : 1 }, { upsert : true });
|
v2.6 => on upsert, confusingly, a random ObjectId is generated
|
v2.8 => error, must specify full _id value
|
Sharded with k : 1:
db.coll.update({ k : { $eq : 1 } }, { $set : { k : 1 } }, { upsert : true })
|
2.6 => error
|
2.8 => upserted with k : 1
|
|
db.coll.update({ k : { $eq : 1 }, k.x : 1 }, { $set : { k : 1 } }, { upsert : true })
|
v2.6 => error, update conflict at mongod
|
v2.8 => error extracting shard key k
|
|