mongo/jstests/core/query/single_batch.js
Joshua Siegel 169f8dc283 SERVER-111817 Add tag to exclude tests from timeseries CRUD suite (#44113)
GitOrigin-RevId: a3ab3b89275fa89c9824f6af467d56d605096159
2025-11-21 18:08:16 +00:00

24 lines
776 B
JavaScript

// Test the "single batch" semantics of negative limit.
// @tags: [
// requires_getmore,
// # Not first stage in pipeline. The following test uses $planCacheStats, which is required to be the
// # first stage in a pipeline. This will be incomplatible with timeseries.
// exclude_from_timeseries_crud_passthrough,
// ]
const coll = db.jstests_single_batch;
coll.drop();
// 1 MB.
const padding = "x".repeat(1024 * 1024);
// Insert ~20 MB of data.
for (let i = 0; i < 20; i++) {
assert.commandWorked(coll.insert({_id: i, padding: padding}));
}
// The limit is 18, but we should end up with fewer documents since 18 docs won't fit in a
// single 16 MB batch.
const numResults = coll.find().limit(-18).itcount();
assert.lt(numResults, 18);
assert.gt(numResults, 0);