diff options
author | Benety Goh <benety@mongodb.com> | 2013-09-13 17:22:16 -0400 |
---|---|---|
committer | Benety Goh <benety@mongodb.com> | 2013-09-13 17:22:16 -0400 |
commit | c3afc0341bd84dbbd68c040647c0fbcf7c7816ec (patch) | |
tree | 26785b70c4ebb21e88a70ca10fde97a571a2b84f /jstests/explain_batch_size.js | |
parent | 6c4f29bf67da8b796c112e9a875463a6c5b52340 (diff) | |
download | mongo-c3afc0341bd84dbbd68c040647c0fbcf7c7816ec.tar.gz |
SERVER-10565 added explain js test to check explain.n when query batch size is smaller than total number of documents requested
Diffstat (limited to 'jstests/explain_batch_size.js')
-rw-r--r-- | jstests/explain_batch_size.js | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/jstests/explain_batch_size.js b/jstests/explain_batch_size.js new file mode 100644 index 00000000000..65bc1df40d7 --- /dev/null +++ b/jstests/explain_batch_size.js @@ -0,0 +1,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(); + +n = 3 +for (i=0; i<n; i++) { + t.save( { x : i } ); +} + +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().n , "C" ); |