0
0
mirror of https://github.com/mongodb/mongo.git synced 2024-11-30 17:10:48 +01:00
mongodb/jstests/index_many.js
2010-01-12 11:55:51 -08:00

35 lines
619 B
JavaScript

t = db.many;
t.drop();
db.many2.drop();
t.save({x:9});
t.save({x:19});
x = 2;
while( x < 60 ) {
patt={};
patt[x] = 1;
if( x == 20 )
patt = { x : 1 };
t.ensureIndex(patt);
x++;
}
// print( tojson(db.getLastErrorObj()) );
assert( db.getLastError(), "should have an error 'too many indexes'" );
// 40 is the limit currently
// print( t.getIndexes().length == 40, "40" );
assert( t.getIndexes().length == 40, "40" );
assert( t.find({x:9}).length() == 1, "b" ) ;
t.renameCollection( "many2" );
assert( t.find({x:9}).length() == 0, "c" ) ;
assert( db.many2.find({x:9}).length() == 1, "d" ) ;