-
Type: Bug
-
Resolution: Duplicate
-
Priority: Critical - P2
-
None
-
Affects Version/s: 2.6.2
-
Component/s: None
-
None
-
ALL
-
Behavior of Mongo update is different in 2.4 vs 2.6.
In our case _id was null so in 2.4 it was creating multiple document and which was correct behavior. in 2.6 the behavior changed and the Id is becoming null which is creating nullpointer exception and later all upsert are only updating that document instead of inserting.
Steps to Reproduce
------------------------------------
try to run following in 2.4 vs 2.6 and see the difference. This is creating issue in our code due to upgrade.
db.books.update(
{_id:1234},
{
item: "XYZ123",
stock: 10,
info:
,
tags: [ "baking", "cooking" ]
},
)
In 2.4 if the document is missing then it is creating the following document.
---------------------------------------
{
"_id" : ObjectId("552eb41bb0af794da9287199"),
"item" : "XYZ123",
"stock" : 10.0,
"info" :
,
"tags" : ["baking", "cooking"]
}
In 2.6 it is creating the following in same condition
----------------------------------------------------------------
{
"_id" : 1234.0,
"item" : "XYZ123",
"stock" : 10.0,
"info" :
,
"tags" : ["baking", "cooking"]
}
- duplicates
-
SERVER-5289 _id field not taken from query during upsert on update
- Closed