summaryrefslogtreecommitdiff
path: root/jstests/core/explain_batch_size.js
blob: d31b54b3f16ff8704da4af8ad8d7130fcf50b956 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
// minimal test to check handling of batch size when explain info is requested
// expected behavior is to return explain.n = total number of documents matching query
// batch size is also tested in another smoke test jstest/explain1.js but that test
// also covers the use of an indexed collection and includes a couple of test cases
// using limit()
//
// @tags: [
//   requires_fastcount,
// ]

t = db.explain_batch_size;
t.drop();

var n = 3;
for (i = 0; i < n; i++) {
    t.save({x: i});
}

var q = {};

assert.eq(n, t.find(q).count(), "A");
assert.eq(n, t.find(q).itcount(), "B");
assert.eq(n, t.find(q).batchSize(1).explain("executionStats").executionStats.nReturned, "C");