[DOCS-12486] Docs for SERVER-15926: Add $round and/or $integer floating-point functions Created: 15/Feb/19  Updated: 13/Nov/23  Resolved: 11/Mar/19

Status: Closed
Project: Documentation
Component/s: manual, Server
Affects Version/s: None
Fix Version/s: 4.1.9, Server_Docs_20231030, Server_Docs_20231106, Server_Docs_20231105, Server_Docs_20231113

Type: Task Priority: Major - P3
Reporter: Kay Kim (Inactive) Assignee: Ravind Kumar (Inactive)
Resolution: Done Votes: 0
Labels: aggregation, expression, neweng
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Documented
documents SERVER-15926 Add $round and/or $integer floating-p... Closed
Related
Participants:
Days since reply: 4 years, 48 weeks, 2 days ago
Epic Link: DOCS: 4.2 Server/Tools

 Description   

Description

Description:

New $round function + precision argument for $trunc function

Engineering Ticket Description:

Inclusion of an $int or $round operator, which can reliably group numbers which are semantically the same is thus desired.

Example:
In attempting to perform bucketing in an aggregation pipeline, where the buckets are defined as "each Xth of range Y", these functions are needed.

bucket = int( (x - min) / (max - min) * bucket_count )
// This relies on the int() function removing any real part of the number.
 
// At a semantic level, the following is the same:
bucket = (x - min - mod(x - min, (max - min) * bucket_count) / ((max - min) / bucket_count) 

Since this is all floating point math it is subject to errors such as 1.000000001 vs 0.999999999, and therefor less accurate.

Scope of changes

  • Update $trunc with new syntax, noting original syntax is still valid
  • Create $round  docs and link appropriately
  • Crosslink between $trunc and $round for users on one page looking for functionality of the other
  • update 4.2 release notes

 



 Comments   
Comment by Githook User [ 11/Mar/19 ]

Author:

{'name': 'rk-mongo', 'email': 'ravind.kumar@mongodb.com'}

Message: DOCS-12486: Adding and agg operators
Branch: master
https://github.com/mongodb/docs/commit/b2cdad7d90870d21dfc058eeedd7db864a352959

Generated at Thu Feb 08 08:05:21 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.