0
0
mirror of https://github.com/mongodb/mongo.git synced 2024-11-30 17:10:48 +01:00

Merge branch 'master' of git@github.com:mongodb/mongo

This commit is contained in:
Aaron 2009-05-20 15:13:55 -04:00
commit fe54a96b59
2 changed files with 9 additions and 2 deletions

View File

@ -32,11 +32,12 @@ t2.drop();
for( i = 0; i < 1000; ++i ) {
t.save( {i:i} );
}
assert.commandWorked( db.runCommand( { convertToCapped:"jstests_capped3", size:1000 } ) );
//assert.commandWorked( db.runCommand( { convertToCapped:"jstests_capped3", size:1000 } ) );
assert( t.convertToCapped( 1000 ).ok )
c = t.find().sort( {$natural:-1} );
i = 999;
while( c.hasNext() ) {
assert.eq( i--, c.next().i );
}
assert( i < 990 );
assert( i > 900 );
assert( i > 900 );

View File

@ -348,6 +348,12 @@ DBCollection.prototype.totalIndexSize = function(){
return total;
}
DBCollection.prototype.convertToCapped = function( bytes ){
if ( ! bytes )
throw "have to specify # of bytes";
return this._dbCommand( { convertToCapped : this._shortName , size : bytes } )
}
DBCollection.prototype.toString = function(){
return this.getFullName();
}