summaryrefslogtreecommitdiff
path: root/jstests
diff options
context:
space:
mode:
authorAaron <aaron@10gen.com>2009-05-18 17:20:02 -0400
committerAaron <aaron@10gen.com>2009-05-18 17:20:02 -0400
commit65afb6db81668ac5a9a588c55c9d6fc85f1bc906 (patch)
tree67da62f69c92fb1475f715b85368220e4cd840a5 /jstests
parentafb9b899080b7af755f0abbadf6952d19247241b (diff)
parent2117aef610a7dd4b8cbd06d29100fed44cd187ae (diff)
downloadmongo-65afb6db81668ac5a9a588c55c9d6fc85f1bc906.tar.gz
Merge branch 'master' of git@github.com:mongodb/mongo
Diffstat (limited to 'jstests')
-rw-r--r--jstests/capped3.js17
-rw-r--r--jstests/rename.js18
2 files changed, 34 insertions, 1 deletions
diff --git a/jstests/capped3.js b/jstests/capped3.js
index 7dc48559af2..4bb6dcc4ea5 100644
--- a/jstests/capped3.js
+++ b/jstests/capped3.js
@@ -24,4 +24,19 @@ i = 999;
while( c.hasNext() ) {
assert.eq( i--, c.next().i );
}
-assert( i < 990 ); \ No newline at end of file
+assert( i < 990 );
+
+t.drop();
+t2.drop();
+
+for( i = 0; i < 1000; ++i ) {
+ t.save( {i:i} );
+}
+assert.commandWorked( db.runCommand( { convertToCapped:"jstests_capped3", size:1000 } ) );
+c = t.find().sort( {$natural:-1} );
+i = 999;
+while( c.hasNext() ) {
+ assert.eq( i--, c.next().i );
+}
+assert( i < 990 );
+assert( i > 900 ); \ No newline at end of file
diff --git a/jstests/rename.js b/jstests/rename.js
index a6421b7128e..0b8bf954328 100644
--- a/jstests/rename.js
+++ b/jstests/rename.js
@@ -22,3 +22,21 @@ assert.eq( 0, a.find().count() );
assert.eq( 2, b.find().count() );
assert.eq( 3, db.system.indexes.find( {ns:"test.jstests_rename_b"} ).count() );
assert( b.find( {a:1} ).explain().cursor.match( /^BtreeCursor/ ) );
+
+// now try renaming a capped collection
+
+a.drop();
+b.drop();
+c.drop();
+
+db.createCollection( "jstests_rename_a", {capped:true,size:100} );
+for( i = 0; i < 10; ++i ) {
+ a.save( { i: i } );
+}
+assert.commandWorked( admin.runCommand( {renameCollection:"test.jstests_rename_a", to:"test.jstests_rename_b"} ) );
+assert.eq( 1, b.count( {i:9} ) );
+for( i = 10; i < 20; ++i ) {
+ b.save( { i: i } );
+}
+assert.eq( 0, b.count( {i:9} ) );
+assert.eq( 1, b.count( {i:19} ) );