Details
-
Improvement
-
Resolution: Done
-
Minor - P4
-
None
-
None
-
None
-
Query
-
Fully Compatible
Description
For the following update (which results in an insert) this should not be allowed because it produces a document without constant _id field ordering:
db.a.update({"_id.a":1, "_id.b":2}, {$inc:{x:1}}, {upsert:true})
|
db.a.find()
|
{_id:{a:1, b:2}, x:1}
|
db.a.remove({})
|
db.a.update({"_id.b":1}, {$inc:{x:1}, $setOnInsert:{"_id.a":2}}, {upsert:true})
|
db.a.find()
|
{_id:{b:1,a:2}, x:1}
|