-
Type: Bug
-
Resolution: Works as Designed
-
Priority: Minor - P4
-
None
-
Affects Version/s: None
-
Component/s: None
-
Query Execution
-
v4.4, v4.2, v4.0
-
Query 2021-01-11, Query Execution 2021-05-03, Query Execution 2021-05-17, QE 2021-10-18, QE 2021-11-01, QE 2021-11-15, QE 2021-11-29, QE 2021-12-13, QE 2021-12-27
I have a problem when I truncate a number that has the same decimals that have the <place> value. the problem is that the value is round to down and give the wrong number. I have the following situation:
a number: 4.56 in my DB and the following query: { $project: { newField: { $trunc: ["$number", 2] }} }
the outcome of this query is 4.55 a wrong value, I was expecting to get the same number that I stored before. The documentation says the following:
Because of that, I don't understand the reason for the error and also the documentation doesn't show an example when the <place> and the <number> has the same digits.
Image reference:
Data on the DB
Output, after apply the query
- related to
-
SERVER-71557 The server does not always round half to even
- Closed