summaryrefslogtreecommitdiff
path: root/src/mongo/db/pipeline
diff options
context:
space:
mode:
authorDavis Haupt <davis.haupt@mongodb.com>2021-10-08 20:48:14 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2021-10-08 21:13:43 +0000
commitcb721afab428783c002fc04fee1e317ec89d5a08 (patch)
tree933d2c5d2924cf1e183a72bafdb2a4b33a753129 /src/mongo/db/pipeline
parent67bc82b140451138e4bf10682ad92289980c2add (diff)
downloadmongo-cb721afab428783c002fc04fee1e317ec89d5a08.tar.gz
SERVER-60447 remove TODO and elaborate on runtime considerations
Diffstat (limited to 'src/mongo/db/pipeline')
-rw-r--r--src/mongo/db/pipeline/document_source_densify.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/mongo/db/pipeline/document_source_densify.cpp b/src/mongo/db/pipeline/document_source_densify.cpp
index 6276a8e4caf..879ac91553f 100644
--- a/src/mongo/db/pipeline/document_source_densify.cpp
+++ b/src/mongo/db/pipeline/document_source_densify.cpp
@@ -898,13 +898,13 @@ bool DensifyValue::isOnStepRelativeTo(DensifyValue base, RangeStatement range) c
// Months, quarters and years have variable lengths depending on leap days
// and days-in-a-month, so a step is not a constant number of milliseconds
// across all dates. For these units, we need to iterate through rather than
- // performing a calculation with modulo.
+ // performing a calculation with modulo. As long as `baseDate` is not a large number
+ // of steps away from the value we're testing (as is true in our usage with _current
+ // as the base), this should not be a performance issue.
if (unit == TimeUnit::month || unit == TimeUnit::quarter ||
unit == TimeUnit::year) {
Date_t steppedDate = baseDate;
- // TODO SERVER-60202: Could be sped up with binary search rather than stepping
- // sequentially.
while (steppedDate < date) {
steppedDate = dateAdd(steppedDate, unit, step, timezone());
}