[SERVER-22025] Attempt to update Double to NumberInt is ignored Created: 29/Dec/15  Updated: 29/Dec/15  Resolved: 29/Dec/15

Status: Closed
Project: Core Server
Component/s: None
Affects Version/s: 3.0.8, 3.2.0
Fix Version/s: None

Type: Bug Priority: Major - P3
Reporter: Cailin Nelson Assignee: Unassigned
Resolution: Duplicate Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Duplicate
duplicates SERVER-16801 update considers a change in numerica... Closed
Operating System: ALL
Participants:

 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 }



 Comments   
Comment by Scott Hernandez (Inactive) [ 29/Dec/15 ]

Duplicate of SERVER-16801

Generated at Thu Feb 08 03:59:11 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.