summaryrefslogtreecommitdiff
path: root/jstests/capped5.js
diff options
context:
space:
mode:
authorAaron <aaron@10gen.com>2010-01-19 11:44:17 -0800
committerAaron <aaron@10gen.com>2010-01-19 11:44:17 -0800
commit84ec76b935af3a8a848a351ee24dc28688994d97 (patch)
tree1859414630b6beb631d2a8cb636a5a43d74561ca /jstests/capped5.js
parent737776e3b8159dcfb87c9417d56b39c0fd8ab0fc (diff)
downloadmongo-84ec76b935af3a8a848a351ee24dc28688994d97.tar.gz
SERVER-525 more capped collection / unique index tests
Diffstat (limited to 'jstests/capped5.js')
-rw-r--r--jstests/capped5.js32
1 files changed, 32 insertions, 0 deletions
diff --git a/jstests/capped5.js b/jstests/capped5.js
index a5d04de7480..d0e13d631d1 100644
--- a/jstests/capped5.js
+++ b/jstests/capped5.js
@@ -16,3 +16,35 @@ t.ensureIndex( { x : 1 } )
assert.eq( 52 , t.findOne( { x : 11 } ).z , "B1" );
assert.eq( 52 , t.findOne( { _id : 5 } ).z , "B2" );
+
+t.drop();
+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( 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 );
+
+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, t.find().hint( {x:1} ).toArray().length );
+
+// SERVER-525
+//t.drop();
+//db.createCollection( tn , {capped: true, size: 1024 * 1024 * 1 } );
+//t.ensureIndex( { _id:1 } );
+//t.insert( { _id : 5 , x : 11 } );
+//t.insert( { _id : 5 , x : 12 } );
+//assert.eq( 1, t.find().toArray().length );