diff options
Diffstat (limited to 'jstests/core/capped_max1.js')
-rw-r--r-- | jstests/core/capped_max1.js | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/jstests/core/capped_max1.js b/jstests/core/capped_max1.js index 7811489773b..e4fbda62233 100644 --- a/jstests/core/capped_max1.js +++ b/jstests/core/capped_max1.js @@ -5,24 +5,26 @@ t.drop(); var max = 10; var maxSize = 64 * 1024; -db.createCollection( t.getName() , {capped: true, size: maxSize, max: max } ); -assert.eq( max, t.stats().max ); -assert.eq( maxSize, t.stats().maxSize ); -assert.eq( Math.floor(maxSize/1000), t.stats(1000).maxSize ); +db.createCollection(t.getName(), {capped: true, size: maxSize, max: max}); +assert.eq(max, t.stats().max); +assert.eq(maxSize, t.stats().maxSize); +assert.eq(Math.floor(maxSize / 1000), t.stats(1000).maxSize); -for ( var i=0; i < max * 2; i++ ) { - t.insert( { x : i } ); +for (var i = 0; i < max * 2; i++) { + t.insert({x: i}); } -assert.eq( max, t.count() ); +assert.eq(max, t.count()); // Test invalidation of cursors var cursor = t.find().batchSize(4); assert(cursor.hasNext()); var myX = cursor.next(); -for ( var j = 0; j < max * 2; j++ ) { - t.insert( { x : j+i } ); +for (var j = 0; j < max * 2; j++) { + t.insert({x: j + i}); } // Cursor should now be dead. -assert.throws(function () { cursor.toArray(); }); +assert.throws(function() { + cursor.toArray(); +}); |