summaryrefslogtreecommitdiff
path: root/jstests/core/explain_batch_size.js
blob: 7f94adb13ce05e2c4192d147be054e580ebc5ba2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
// 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()

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");