var coll = db.exhaustColl;
|
coll.drop();
|
|
// Include a long string in each document so that the documents are a bit bigger than 16KB.
|
const strSize = 16 * 1024;
|
// The docs are ~16KB and each getMore response is 16MB. Therefore, a full getMore batch will
|
// contain about 1000 documents. Since the initial find response is limited to only 101 documents,
|
// by inserting 3000 we ensure that three subsequent getMore replies are required. Roughly speaking,
|
// the initial reply will consist of the first 100, the first getMore reply 1000 more, then another
|
// 1000, and then the remaining 900.
|
const numDocs = 3000;
|
|
const str = "A".repeat(strSize);
|
|
let bulk = coll.initializeUnorderedBulkOp();
|
for (let i = 0; i < numDocs; ++i) {
|
bulk.insert({key: str});
|
}
|
assert.commandWorked(bulk.execute());
|
|
assert.eq(numDocs, coll.find().limit(10000).addOption(DBQuery.Option.exhaust).itcount());
|