Details
-
Bug
-
Status: Closed
-
Major - P3
-
Resolution: Fixed
-
None
-
Fully Compatible
-
ALL
-
v4.2, v4.0, v3.6
-
Query 2019-09-09
-
(copied to CRM)
-
0
Description
When pipeline optimization is enabled, the arguments to the $multiply operator can be re-arranged. In certain cases, when one of the arguments is Infinity (or NaN), this re-arrangement may result in an error. But when the pipeline optimization is disabled, the very same query returns without an error.
For example,
db.col.insert({num: Infinity})
|
db.col.aggregate({$project: {a: {$multiply: [NumberDecimal(1), "$num"]}}}) |
2019-08-09T11:32:49.176+0100 E QUERY [js] Error: command failed: { |
"ok" : 0, |
"errmsg" : "Can't coerce out of range value inf to long", |
"code" : 31109, |
"codeName" : "Location31109" |
}
|
db.adminCommand({configureFailPoint: 'disablePipelineOptimization', mode: 'alwaysOn'}) |
db.col.aggregate({$project: {a: {$multiply: [NumberDecimal(1), "$num"]}}}) |
{ "_id" : ObjectId("5d4d4ba7bf418d2f35ef7d3c"), "a" : NumberDecimal("Infinity") } |
Attachments
Issue Links
- is duplicated by
-
SERVER-42151 $multiply with NaN operand violates commutativity
-
- Closed
-