diff options
-rw-r--r-- | jstests/core/index10.js | 20 | ||||
-rw-r--r-- | jstests/core/index8.js | 6 | ||||
-rw-r--r-- | jstests/core/index9.js | 14 | ||||
-rw-r--r-- | jstests/core/indexOtherNamespace.js | 5 | ||||
-rw-r--r-- | jstests/core/ns_length.js | 4 | ||||
-rw-r--r-- | jstests/mmap_v1/extent.js (renamed from jstests/core/extent.js) | 0 | ||||
-rw-r--r-- | jstests/mmap_v1/extent2.js (renamed from jstests/core/extent2.js) | 0 | ||||
-rw-r--r-- | jstests/mmap_v1/index_check1.js (renamed from jstests/core/index_check1.js) | 0 | ||||
-rw-r--r-- | jstests/mmap_v1/indexh.js (renamed from jstests/core/indexh.js) | 0 | ||||
-rw-r--r-- | jstests/mmap_v1/indexi.js (renamed from jstests/core/indexi.js) | 0 | ||||
-rw-r--r-- | jstests/mmap_v1/stats.js (renamed from jstests/core/stats.js) | 0 |
11 files changed, 24 insertions, 25 deletions
diff --git a/jstests/core/index10.js b/jstests/core/index10.js index 41f58816f1f..f9e13466033 100644 --- a/jstests/core/index10.js +++ b/jstests/core/index10.js @@ -3,11 +3,11 @@ t = db.jstests_index10; t.drop(); -t.save( {i:1} ); -t.save( {i:2} ); -t.save( {i:1} ); -t.save( {i:3} ); -t.save( {i:1} ); +t.save( {_id:1, i:1} ); +t.save( {_id:2, i:2} ); +t.save( {_id:3, i:1} ); +t.save( {_id:4, i:3} ); +t.save( {_id:5, i:1} ); t.ensureIndex( {i:1} ); assert.eq( 5, t.count() ); @@ -16,17 +16,17 @@ var err = t.ensureIndex( {i:1}, true ); assert.commandFailed(err) assert.eq( 11000, err.code ); -assert( 1 == db.system.indexes.count( {ns:"test.jstests_index10" } ), "only id index" ); +assert( 1 == t.getIndexes().length, "only id index" ); // t.dropIndexes(); -ts = t.totalIndexSize(); t.ensureIndex( {i:1}, [ true, true ] ); -ts2 = t.totalIndexSize(); - -assert.eq( ts * 2, ts2, "totalIndexSize fail" ); assert.eq( 3, t.count() ); assert.eq( 1, t.count( {i:1} ) ); +stats = t.stats(); +assert.eq( stats.indexSizes["_id_"], + stats.indexSizes["i_1"] ); + t.ensureIndex( {j:1}, [ true, true ] ); assert.eq( 1, t.count() ); diff --git a/jstests/core/index8.js b/jstests/core/index8.js index 719ad2dd2cb..946e008a0e2 100644 --- a/jstests/core/index8.js +++ b/jstests/core/index8.js @@ -8,8 +8,9 @@ t.ensureIndex( { b: 1 }, true ); t.ensureIndex( { c: 1 }, [ false, "cIndex" ] ); checkIndexes = function( num ) { -// printjson( db.system.indexes.find( { ns: "test.jstests_index8" } ).toArray() ); - indexes = db.system.indexes.find( { ns: "test.jstests_index8" } ).sort( { key: 1 } ).toArray(); + var indexes = t.getIndexes(); + assert.eq( 4, indexes.length ); + var start = 0; if ( indexes[0].name == "_id_" ) start = 1; @@ -20,7 +21,6 @@ checkIndexes = function( num ) { } checkIndexes( 1 ); - t.reIndex(); checkIndexes( 2 ); diff --git a/jstests/core/index9.js b/jstests/core/index9.js index 04b900949ec..8fee4a35ca0 100644 --- a/jstests/core/index9.js +++ b/jstests/core/index9.js @@ -2,24 +2,24 @@ t = db.jstests_index9; t.drop(); db.createCollection( "jstests_index9" ); -assert.eq( 1, db.system.indexes.count( {ns: "test.jstests_index9"} ), "There should be 1 index with default collection" ); +assert.eq( 1, t.getIndexes().length, "There should be 1 index with default collection" ); t.drop(); db.createCollection( "jstests_index9", {autoIndexId: true} ); -assert.eq( 1, db.system.indexes.count( {ns: "test.jstests_index9"} ), "There should be 1 index if autoIndexId: true" ); +assert.eq( 1, t.getIndexes().length, "There should be 1 index if autoIndexId: true" ); t.drop(); db.createCollection( "jstests_index9", {autoIndexId:false} ); -assert.eq( 0, db.system.indexes.count( {ns: "test.jstests_index9"} ), "There should be 0 index if autoIndexId: false" ); +assert.eq( 0, t.getIndexes().length, "There should be 0 index if autoIndexId: false" ); t.createIndex( { _id:1 } ); -assert.eq( 1, db.system.indexes.count( {ns: "test.jstests_index9"} ) ); +assert.eq( 1, t.getIndexes().length ); t.createIndex( { _id:1 } ); -assert.eq( 1, db.system.indexes.count( {ns: "test.jstests_index9"} ) ); +assert.eq( 1, t.getIndexes().length ); t.drop(); t.createIndex( { _id:1 } ); -assert.eq( 1, db.system.indexes.count( {ns: "test.jstests_index9"} ) ); +assert.eq( 1, t.getIndexes().length ); t.drop(); t.save( {a:1} ); t.createIndex( { _id:1 } ); -assert.eq( 1, db.system.indexes.count( {ns: "test.jstests_index9"} ) ); +assert.eq( 1, t.getIndexes().length ); diff --git a/jstests/core/indexOtherNamespace.js b/jstests/core/indexOtherNamespace.js index da026616cc6..f71e6d36558 100644 --- a/jstests/core/indexOtherNamespace.js +++ b/jstests/core/indexOtherNamespace.js @@ -4,14 +4,13 @@ var otherDB = db.getSiblingDB("indexOtherNS"); otherDB.dropDatabase(); otherDB.foo.insert({a:1}) -assert.eq(1, otherDB.system.indexes.count()); +assert.eq(1, otherDB.foo.getIndexes().length); assert.eq("BasicCursor", otherDB.foo.find({a:1}).explain().cursor); assert.writeError(otherDB.randomNS.system.indexes.insert({ ns: "indexOtherNS.foo", key: { a: 1 }, name: "a_1"})); // Assert that index didn't actually get built -assert.eq(1, otherDB.system.indexes.count()); -assert.eq(null, otherDB.system.namespaces.findOne({name : "indexOtherNS.foo.$a_1"})); +assert.eq(1, otherDB.foo.getIndexes().length); assert.eq("BasicCursor", otherDB.foo.find({a:1}).explain().cursor); otherDB.dropDatabase(); diff --git a/jstests/core/ns_length.js b/jstests/core/ns_length.js index 557e3110195..20825818174 100644 --- a/jstests/core/ns_length.js +++ b/jstests/core/ns_length.js @@ -16,7 +16,7 @@ function mkStr(length) { } function canMakeCollectionWithName(name) { - assert.eq(myDb.stats().fileSize, 0, "initial conditions"); + assert.eq(myDb.stats().storageSize, 0, "initial conditions"); var success = false; try { @@ -27,7 +27,7 @@ function canMakeCollectionWithName(name) { } if (!success) { - assert.eq(myDb.stats().fileSize, 0, "no files should be created on error"); + assert.eq(myDb.stats().storageSize, 0, "no files should be created on error"); return false; } diff --git a/jstests/core/extent.js b/jstests/mmap_v1/extent.js index 47ae868606a..47ae868606a 100644 --- a/jstests/core/extent.js +++ b/jstests/mmap_v1/extent.js diff --git a/jstests/core/extent2.js b/jstests/mmap_v1/extent2.js index 75bf0d0b1b8..75bf0d0b1b8 100644 --- a/jstests/core/extent2.js +++ b/jstests/mmap_v1/extent2.js diff --git a/jstests/core/index_check1.js b/jstests/mmap_v1/index_check1.js index 7113dff0877..7113dff0877 100644 --- a/jstests/core/index_check1.js +++ b/jstests/mmap_v1/index_check1.js diff --git a/jstests/core/indexh.js b/jstests/mmap_v1/indexh.js index ac2a93ec62b..ac2a93ec62b 100644 --- a/jstests/core/indexh.js +++ b/jstests/mmap_v1/indexh.js diff --git a/jstests/core/indexi.js b/jstests/mmap_v1/indexi.js index 06f185fb689..06f185fb689 100644 --- a/jstests/core/indexi.js +++ b/jstests/mmap_v1/indexi.js diff --git a/jstests/core/stats.js b/jstests/mmap_v1/stats.js index 87891acf2ec..87891acf2ec 100644 --- a/jstests/core/stats.js +++ b/jstests/mmap_v1/stats.js |