diff options
Diffstat (limited to 'jstests/noPassthroughWithMongod/parallel_collection_scan.js')
-rw-r--r-- | jstests/noPassthroughWithMongod/parallel_collection_scan.js | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/jstests/noPassthroughWithMongod/parallel_collection_scan.js b/jstests/noPassthroughWithMongod/parallel_collection_scan.js new file mode 100644 index 00000000000..d745f088376 --- /dev/null +++ b/jstests/noPassthroughWithMongod/parallel_collection_scan.js @@ -0,0 +1,28 @@ + +t = db.parallel_collection_scan; +t.drop(); + +s = ""; +while ( s.length < 10000 ) + s += "."; + +for ( i = 0; i < 8000; i++ ) { + t.insert( { x : i, s : s } ); + } + + +function iterateSliced() { + var res = t.runCommand( "parallelCollectionScan", { numCursors : 3 } ); + assert( res.ok, tojson( res ) ); + var count = 0; + for ( var i = 0; i < res.cursors.length; i++ ) { + var x = res.cursors[i]; + var cursor = new DBCommandCursor( db.getMongo(), x, 5 ); + count += cursor.itcount(); + } + + return count; +} + +assert.eq( iterateSliced(), t.count() ); +assert.eq( iterateSliced(), i ); |