[SERVER-32960] $mod has inconsistent rounding/truncation behavior Created: 29/Jan/18 Updated: 29/Oct/23 Resolved: 19/Nov/20 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | Querying |
| Affects Version/s: | None |
| Fix Version/s: | 4.9.0, 4.0.22, 3.6.22, 4.4.3, 4.2.12 |
| Type: | Bug | Priority: | Major - P3 |
| Reporter: | Charlie Swanson | Assignee: | Nikita Lapkov (Inactive) |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | neweng, query-44-grooming | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||||||||||||||||||||||||||||||||||||||
| Backwards Compatibility: | Minor Change | ||||||||||||||||||||||||||||||||||||||||||||
| Operating System: | ALL | ||||||||||||||||||||||||||||||||||||||||||||
| Backport Requested: |
v4.4, v4.2, v4.0, v3.6
|
||||||||||||||||||||||||||||||||||||||||||||
| Sprint: | Query 2020-11-30 | ||||||||||||||||||||||||||||||||||||||||||||
| Participants: | |||||||||||||||||||||||||||||||||||||||||||||
| Linked BF Score: | 44 | ||||||||||||||||||||||||||||||||||||||||||||
| Description |
|
See We should be consistent here, probably truncating decimals as well as doubles. Also, $mod treats it's divisor and remainder arguments as int values. This could lead to unexpected behaviour when these arguments are larger than int. For example: > db.createCollection('test') ]) The last query should return the single record from the test collection, but returns nothing instead. The suggestion is to truncate decimals and doubles consistently towards zero into long long type. |
| Comments |
| Comment by Githook User [ 19/Nov/20 ] |
|
Author: {'name': 'Nikita Lapkov', 'email': 'nikita.lapkov@mongodb.com', 'username': 'laplab'}Message: |
| Comment by Githook User [ 19/Nov/20 ] |
|
Author: {'name': 'Nikita Lapkov', 'email': 'nikita.lapkov@mongodb.com', 'username': 'laplab'}Message: |
| Comment by Githook User [ 19/Nov/20 ] |
|
Author: {'name': 'Nikita Lapkov', 'email': 'nikita.lapkov@mongodb.com', 'username': 'laplab'}Message: |
| Comment by Githook User [ 19/Nov/20 ] |
|
Author: {'name': 'Nikita Lapkov', 'email': 'nikita.lapkov@mongodb.com', 'username': 'laplab'}Message: |
| Comment by Githook User [ 19/Nov/20 ] |
|
Author: {'name': 'Nikita Lapkov', 'email': 'nikita.lapkov@mongodb.com', 'username': 'laplab'}Message: |
| Comment by Githook User [ 01/Sep/20 ] |
|
Author: {'name': 'Nikita Lapkov', 'email': 'nikita.lapkov@mongodb.com', 'username': 'laplab'}Message: Revert " This reverts commit cb131974041efdcd0b4a99fe3bd316cbb9b4db41. |
| Comment by Nikita Lapkov (Inactive) [ 31/Aug/20 ] |
|
Will revert commit because of BF-18654 |
| Comment by Githook User [ 27/Aug/20 ] |
|
Author: {'name': 'Nikita Lapkov', 'email': 'nikita.lapkov@mongodb.com', 'username': 'laplab'}Message: |