mirror of
https://github.com/mongodb/mongo.git
synced 2024-12-01 09:32:32 +01:00
49 lines
910 B
JavaScript
49 lines
910 B
JavaScript
|
|
t = db.big_object1
|
|
t.drop();
|
|
|
|
if ( db.adminCommand( "buildinfo" ).bits == 64 ){
|
|
|
|
s = ""
|
|
while ( s.length < 850 * 1024 ){
|
|
s += "x";
|
|
}
|
|
|
|
x = 0;
|
|
while ( true ){
|
|
n = { _id : x , a : [] }
|
|
for ( i=0; i<14+x; i++ )
|
|
n.a.push( s )
|
|
try {
|
|
t.insert( n )
|
|
o = n
|
|
}
|
|
catch ( e ){
|
|
break;
|
|
}
|
|
|
|
if ( db.getLastError() != null )
|
|
break;
|
|
x++;
|
|
}
|
|
|
|
printjson( t.stats(1024*1024) )
|
|
|
|
assert.lt( 15 * 1024 * 1024 , Object.bsonsize( o ) , "A1" )
|
|
assert.gt( 17 * 1024 * 1024 , Object.bsonsize( o ) , "A2" )
|
|
|
|
assert.eq( x , t.count() , "A3" )
|
|
|
|
for ( i=0; i<x; i++ ){
|
|
o = t.findOne( { _id : 1 } )
|
|
assert( o , "B" + i );
|
|
}
|
|
|
|
t.drop()
|
|
}
|
|
else {
|
|
print( "skipping big_object1 b/c not 64-bit" )
|
|
}
|
|
|
|
print("SUCCESS");
|