diff options
Diffstat (limited to 'jstests/aggregation/sources/densify/explicit_range.js')
| -rw-r--r-- | jstests/aggregation/sources/densify/explicit_range.js | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/jstests/aggregation/sources/densify/explicit_range.js b/jstests/aggregation/sources/densify/explicit_range.js index 842ae79d5bf..74a92e2b88e 100644 --- a/jstests/aggregation/sources/densify/explicit_range.js +++ b/jstests/aggregation/sources/densify/explicit_range.js @@ -104,4 +104,24 @@ for (let i = 0; i < densifyUnits.length; i++) { runDensifyRangeTest({step, bounds: [10, 45]}); } } + +// Run a test where there are no documents in the range to ensure we don't generate anything before +// the range. +coll.drop(); +let documents = [ + {"date": ISODate("2022-10-29T23:00:00Z")}, +]; +coll.insert(documents); +let stage = { + field: "date", + range: { + step: 1, + unit: "month", + bounds: [ + ISODate("2022-10-31T23:00:00.000Z"), + ISODate("2022-11-30T23:00:00.000Z"), + ], + }, +}; +testDensifyStage(stage, coll, "Ensure no docs before range"); })(); |
