Details
-
Bug
-
Status: Closed
-
Major - P3
-
Resolution: Duplicate
-
3.0.8, 3.2.0
-
None
-
None
-
None
-
ALL
Description
Attempts to $set a Double to NumberInt seem to be ignored when the values are numerically equal.
threetwo:PRIMARY> db.version()
|
3.2.0
|
|
// Insert a document where x is a Double
|
threetwo:PRIMARY> db.foo.insert({x: 1})
|
WriteResult({ "nInserted" : 1 })
|
|
// Verify it's a Double
|
threetwo:PRIMARY> db.foo.find({x: {$type:1}})
|
{ "_id" : ObjectId("56829f8f891b45519f22028c"), "x" : 1 }
|
|
// Update to NumberInt
|
threetwo:PRIMARY> db.foo.update({ "_id" : ObjectId("56829f8f891b45519f22028c")},{$set: {x: NumberInt(1)}})
|
WriteResult({ "nMatched" : 1, "nUpserted" : 0, "nModified" : 0 })
|
|
// Note nModified of 0, and field is still Double
|
threetwo:PRIMARY> db.foo.find({x: {$type:1}})
|
{ "_id" : ObjectId("56829f8f891b45519f22028c"), "x" : 1 }
|
Attachments
Issue Links
- duplicates
-
SERVER-16801 update considers a change in numerical type to be a noop
-
- Closed
-