diff options
author | Eliot Horowitz <eliot@10gen.com> | 2010-12-09 16:59:10 -0500 |
---|---|---|
committer | Eliot Horowitz <eliot@10gen.com> | 2010-12-09 16:59:10 -0500 |
commit | 29d9dab034c6f7df497b76f543ba467e687a9063 (patch) | |
tree | da1f2286ad6230858c0e5c5917c6c7b8e03cdb7f /jstests/big_object1.js | |
parent | 2d44cc04200fb1cd80f3d2255148aa3120ebbd3c (diff) | |
download | mongo-29d9dab034c6f7df497b76f543ba467e687a9063.tar.gz |
increase bson size to 16mb SERVER-431
Diffstat (limited to 'jstests/big_object1.js')
-rw-r--r-- | jstests/big_object1.js | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/jstests/big_object1.js b/jstests/big_object1.js new file mode 100644 index 00000000000..55c22934e00 --- /dev/null +++ b/jstests/big_object1.js @@ -0,0 +1,38 @@ + +t = db.big_object1 +t.drop(); + +s = "" +while ( s.length < 512 * 1024 ){ + s += "x"; +} + +x = 0; +while ( true ){ + o = { _id : x , a : [] } + for ( i=0; i<x; i++ ) + o.a.push( s ) + print( Object.bsonsize( o ) ) + try { + t.insert( o ) + } + catch ( e ){ + break; + } + + if ( db.getLastError() != null ) + break; + x++; +} + +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() |