diff options
author | Kevin Matulef <matulef@gmail.com> | 2012-08-02 08:14:22 -0400 |
---|---|---|
committer | Kevin Matulef <matulef@gmail.com> | 2012-08-02 08:14:22 -0400 |
commit | b202965c2aa985232699b059c7135dd64f09700e (patch) | |
tree | 46990d7966f7631c09d4c7dc8e87b99db999b51d /jstests/capped5.js | |
parent | af67eafd77bb5d77218dae510c5241d410f0337f (diff) | |
download | mongo-b202965c2aa985232699b059c7135dd64f09700e.tar.gz |
SERVER-5516 SERVER-5304 SERVER-6577 new capped collections now get _id index by default (except in local db)
Diffstat (limited to 'jstests/capped5.js')
-rw-r--r-- | jstests/capped5.js | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/jstests/capped5.js b/jstests/capped5.js index be6c27d7256..9af06f84063 100644 --- a/jstests/capped5.js +++ b/jstests/capped5.js @@ -7,7 +7,7 @@ t.drop(); db.createCollection( tn , {capped: true, size: 1024 * 1024 * 1 } ); t.insert( { _id : 5 , x : 11 , z : 52 } ); -assert.eq( 0 , t.getIndexKeys().length , "A0" ) +assert.eq( 1 , t.getIndexKeys().length , "A0" ) //now we assume _id index even on capped coll assert.eq( 52 , t.findOne( { x : 11 } ).z , "A1" ); t.ensureIndex( { _id : 1 } ) @@ -21,23 +21,22 @@ db.createCollection( tn , {capped: true, size: 1024 * 1024 * 1 } ); t.insert( { _id : 5 , x : 11 } ); t.insert( { _id : 6 , x : 11 } ); t.ensureIndex( { x:1 }, {unique:true, dropDups:true } ); -assert.eq( 0, db.system.indexes.count( {ns:"test."+tn} ) ); +assert.eq( 1, db.system.indexes.count( {ns:"test."+tn} ) ); //now we assume _id index assert.eq( 2, t.find().toArray().length ); t.drop(); db.createCollection( tn , {capped: true, size: 1024 * 1024 * 1 } ); t.insert( { _id : 5 , x : 11 } ); t.insert( { _id : 5 , x : 12 } ); -t.ensureIndex( { _id:1 } ); -assert.eq( 0, db.system.indexes.count( {ns:"test."+tn} ) ); -assert.eq( 2, t.find().toArray().length ); +assert.eq( 1, db.system.indexes.count( {ns:"test."+tn} ) ); //now we assume _id index +assert.eq( 1, t.find().toArray().length ); //_id index unique, so second insert fails t.drop(); db.createCollection( tn , {capped: true, size: 1024 * 1024 * 1 } ); t.insert( { _id : 5 , x : 11 } ); t.insert( { _id : 6 , x : 12 } ); t.ensureIndex( { x:1 }, {unique:true, dropDups:true } ); -assert.eq( 1, db.system.indexes.count( {ns:"test."+tn} ) ); +assert.eq( 2, db.system.indexes.count( {ns:"test."+tn} ) ); //now we assume _id index assert.eq( 2, t.find().hint( {x:1} ).toArray().length ); // SERVER-525 (closed) unique indexes in capped collection |