[DOCS-15545] Investigate changes in SERVER-68543: Make $add operator type left associate for date in classic engine Created: 17/Aug/22  Updated: 22/Jan/24

Status: Backlog
Project: Documentation
Component/s: manual, Server
Affects Version/s: None
Fix Version/s: 6.1.0-rc0

Type: Task Priority: Major - P3
Reporter: Backlog - Core Eng Program Management Team Assignee: Unassigned
Resolution: Unresolved Votes: 0
Labels: backlog, feature, query, server-docs-bug-bash
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Documented
documents SERVER-68543 Make $add operator type left associat... Closed
Participants:
Days since reply: 1 year, 25 weeks ago

 Description   
Original Downstream Change Summary

Changes in classic query engine, SBE change is done in SERVER-67282
[1.5, date, 1.5] result change: date + 3 -> date + 4 due to rounding

https://docs.google.com/document/d/1J4lkN3eRJSB6mM01NtZ9QQam7ilA_d5CAdb_YBgeGkU/edit?usp=sharing

Description of Linked Ticket

Currently $add always use widest numerical type to do summation, then cast to date type if there's a date element in the array.

This is fine for all numeric types except date which could cause confusion:

[1.5 + date + 1.5] can be either date + 3 or date + 4, the later one comes from round(round(date + 1.5) + 1.5).

 

We should make the $add type left associate for date type, so when we are date to any number the result is casted to date, and following (right side) numbers are all added and casted to date type. code link

(We will not backport this change to 6.0 or earlier)

(this ticket is for classic engine, sbe change will be included in SERVER-67282)

 



 Comments   
Comment by Education Bot [ 17/Aug/22 ]

Fix Version updated for upstream SERVER-68543:
6.1.0-rc0

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