Pre-epoch date arithmetic upgrade compatibility
Parent: MongoDB Aggregation Pipeline · Published reference · snapshot 2026-10-29
↓ Facts as markdownall context files
Source-anchored research for Pre-epoch date arithmetic upgrade compatibility. Run status: COMPLETED.
These notes link each claim to its source. Some citations identify archived research reports that are no longer hosted on this site. A published reference means the content is available; it does not certify independent review or accuracy.Read the editorial policy and follow the sources before relying on a claim.
Structure and components
- The inspected MongoDB unit tests include pre-epoch date-part extraction in UTC and America/New_York and DateAdd tests for positive and negative second and millisecond amounts. Those tests are useful fixture patterns, but do not by themselves prove cross-version 8.3 compatibility. (low confidence) (verified as of 2026-10-27) [source]
How it works
- MongoDB documents that, starting in 8.3, $dateAdd and $dateSubtract return a result one second greater than previous versions when the input precedes 1970-01-01T00:00:00Z and unit is not millisecond. This describes a timestamp difference, not an execution-time increase. (high confidence) (verified as of 2026-10-27) [source]
Problems, failure modes and limitations
- The release notes explicitly extend the compatibility warning to aggregations performing time-based calculations, including $setWindowFields and $densify. They do not say every output document or accumulator changes by exactly one second. (high confidence) (verified as of 2026-10-27) [source]
- Alibaba Cloud lists the same pre-epoch/non-millisecond condition but describes results as one second slower. MongoDB and Percona describe a timestamp that is one second greater; the Alibaba wording alone cannot substantiate a query-latency regression. (medium confidence) (verified as of 2026-09-10) [source]
Facts and statements
- The documented pre-epoch compatibility condition excludes millisecond units and inputs at or after the UTC epoch; it does not establish a general one-second shift for every date expression. (high confidence) (verified as of 2026-10-27) [source]
- Do not assume replacing calendar units with fixed millisecond durations preserves semantics: $dateAdd uses the selected timezone for calculation, applies daylight-saving offsets, and adjusts month-or-larger additions at month ends. The implementation gives millisecond addition a separate direct-duration path. (medium confidence) [source]
- The inspected MongoDB master implementation floors negative fractional seconds in seconds(Date_t) and handles TimeUnit::millisecond by direct addition. These implementation details help select regression inputs; an unpinned master snapshot does not identify the commit responsible for the 8.3 compatibility change. (low confidence) (verified as of 2026-10-27) [source]
- Do not automatically replace day, month, or year arithmetic with fixed millisecond counts: both operators apply timezone rules, including DST where applicable, and adjust month-or-larger arithmetic to the last valid day of the month. (high confidence) [source]
- In the reviewed master implementation, dateAdd returns date + Milliseconds(amount) immediately for the millisecond unit; other units pass through timezone/timelib processing. This supports separate millisecond controls but does not prove the implementation of a particular 8.3 patch. (low confidence) (verified as of 2026-10-27) [source]
- The reviewed upstream test file includes dateAdd tests for DST transitions, fixed-offset timezones, seconds, milliseconds, and overflow. These are useful test dimensions, but they do not constitute a before/after upgrade execution result. (low confidence) (verified as of 2026-10-27) [source]
Children
- No children recorded.