summaryrefslogtreecommitdiff
path: root/jstests/capped5.js
diff options
context:
space:
mode:
authorKevin Matulef <matulef@gmail.com>2012-08-02 08:14:22 -0400
committerKevin Matulef <matulef@gmail.com>2012-08-02 08:14:22 -0400
commitb202965c2aa985232699b059c7135dd64f09700e (patch)
tree46990d7966f7631c09d4c7dc8e87b99db999b51d /jstests/capped5.js
parentaf67eafd77bb5d77218dae510c5241d410f0337f (diff)
downloadmongo-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.js11
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