diff options
Diffstat (limited to 'jstests/core/index_bigkeys.js')
-rw-r--r--[-rwxr-xr-x] | jstests/core/index_bigkeys.js | 49 |
1 files changed, 24 insertions, 25 deletions
diff --git a/jstests/core/index_bigkeys.js b/jstests/core/index_bigkeys.js index 4b692ce1b19..564ddde2a5e 100755..100644 --- a/jstests/core/index_bigkeys.js +++ b/jstests/core/index_bigkeys.js @@ -5,20 +5,19 @@ var keys = []; var str = "aaaabbbbccccddddeeeeffffgggghhhh"; -while ( str.length < 20000 ) { - keys.push( str ); +while (str.length < 20000) { + keys.push(str); str = str + str; } -function doInsert( order ) { +function doInsert(order) { if (order == 1) { for (var i = 0; i < 10; i++) { - t.insert({ _id: i, k: keys[i] }); + t.insert({_id: i, k: keys[i]}); } - } - else { + } else { for (var i = 9; i >= 0; i--) { - t.insert({ _id: i, k: keys[i] }); + t.insert({_id: i, k: keys[i]}); } } } @@ -27,33 +26,33 @@ var expect = null; function check() { assert(t.validate().valid); - assert.eq( 5, t.count() ); + assert.eq(5, t.count()); - var c = t.find({ k: /^a/ }).count(); - assert.eq( 5, c ); + var c = t.find({k: /^a/}).count(); + assert.eq(5, c); } -function runTest( order ) { +function runTest(order) { t.drop(); - t.ensureIndex({ k: 1 }); - doInsert( order ); - check(); // check incremental addition + t.ensureIndex({k: 1}); + doInsert(order); + check(); // check incremental addition t.reIndex(); - check(); // check bottom up + check(); // check bottom up t.drop(); - doInsert( order ); - assert.eq( 1, t.getIndexes().length ); - t.ensureIndex({ k: 1 }); - assert.eq( 1, t.getIndexes().length ); + doInsert(order); + assert.eq(1, t.getIndexes().length); + t.ensureIndex({k: 1}); + assert.eq(1, t.getIndexes().length); t.drop(); - doInsert( order ); - assert.eq( 1, t.getIndexes().length ); - t.ensureIndex({ k: 1 }, { background: true }); - assert.eq( 1, t.getIndexes().length ); + doInsert(order); + assert.eq(1, t.getIndexes().length); + t.ensureIndex({k: 1}, {background: true}); + assert.eq(1, t.getIndexes().length); } -runTest( 1 ); -runTest( 2 ); +runTest(1); +runTest(2); |