diff options
author | Benety Goh <benety@mongodb.com> | 2020-11-17 14:40:33 -0500 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2020-11-17 21:02:42 +0000 |
commit | 376ef6848fe34ae1c904cdb5eb3bd21a60a35485 (patch) | |
tree | 03703eb62e46457a3dfcd3da5098058c7b5c5951 /jstests | |
parent | efa320e38916e2a4fd52d808e326af11d2b7938c (diff) | |
download | mongo-376ef6848fe34ae1c904cdb5eb3bd21a60a35485.tar.gz |
SERVER-52526 limit number of measurements in each bucket in a time-series collection
Diffstat (limited to 'jstests')
-rw-r--r-- | jstests/core/time_series/time_series_bucket_limit_count.js | 25 |
1 files changed, 21 insertions, 4 deletions
diff --git a/jstests/core/time_series/time_series_bucket_limit_count.js b/jstests/core/time_series/time_series_bucket_limit_count.js index 8f347d4b7d1..feddbf4e200 100644 --- a/jstests/core/time_series/time_series_bucket_limit_count.js +++ b/jstests/core/time_series/time_series_bucket_limit_count.js @@ -53,11 +53,11 @@ for (let i = 0; i < numDocs; i++) { // Check bucket collection. const bucketDocs = bucketsColl.find().sort({_id: 1}).toArray(); -assert.eq(1, bucketDocs.length, bucketDocs); +assert.eq(2, bucketDocs.length, bucketDocs); // Check both buckets. // First bucket should be full with 'bucketMaxCount' documents. -assert.eq(numDocs, +assert.eq(bucketMaxCount, bucketDocs[0].control.count, 'invalid count in first bucket: ' + tojson(bucketDocs[0])); assert.eq(0, @@ -66,10 +66,27 @@ assert.eq(0, assert.eq(0, bucketDocs[0].control.min.x, 'invalid control.min for x in first bucket: ' + tojson(bucketDocs[0].control)); -assert.eq(numDocs - 1, +assert.eq(bucketMaxCount - 1, bucketDocs[0].control.max._id, 'invalid control.max for _id in first bucket: ' + tojson(bucketDocs[0].control)); -assert.eq(numDocs - 1, +assert.eq(bucketMaxCount - 1, bucketDocs[0].control.max.x, 'invalid control.max for x in first bucket: ' + tojson(bucketDocs[0].control)); + +// Second bucket should contain the remaining documents. +assert.eq(numDocs - bucketMaxCount, + bucketDocs[1].control.count, + 'invalid count in second bucket: ' + tojson(bucketDocs[1])); +assert.eq(bucketMaxCount, + bucketDocs[1].control.min._id, + 'invalid control.min for _id in second bucket: ' + tojson(bucketDocs[1].control)); +assert.eq(bucketMaxCount, + bucketDocs[1].control.min.x, + 'invalid control.min for x in second bucket: ' + tojson(bucketDocs[1].control)); +assert.eq(numDocs - 1, + bucketDocs[1].control.max._id, + 'invalid control.max for _id in second bucket: ' + tojson(bucketDocs[1].control)); +assert.eq(numDocs - 1, + bucketDocs[1].control.max.x, + 'invalid control.max for x in second bucket: ' + tojson(bucketDocs[1].control)); })(); |