0
0
mirror of https://github.com/mongodb/mongo.git synced 2024-12-01 09:32:32 +01:00
mongodb/jstests/datasize.js
2009-04-02 17:32:11 -04:00

28 lines
1.4 KiB
JavaScript

f = db.jstests_datasize;
f.drop();
assert.eq( 0, db.runCommand( {datasize:"test.jstests_datasize"} ).size );
f.save( {_id:'c'} );
assert.eq( 16, db.runCommand( {datasize:"test.jstests_datasize"} ).size );
f.save( {_id:'fg'} );
assert.eq( 33, db.runCommand( {datasize:"test.jstests_datasize"} ).size );
f.drop();
f.ensureIndex( {_id:1} );
assert.eq( 0, db.runCommand( {datasize:"test.jstests_datasize"} ).size );
f.save( {_id:'c'} );
assert.eq( 16, db.runCommand( {datasize:"test.jstests_datasize"} ).size );
f.save( {_id:'fg'} );
assert.eq( 33, db.runCommand( {datasize:"test.jstests_datasize"} ).size );
assert.eq( 0, db.runCommand( {datasize:"test.jstests_datasize", min:{_id:'a'}} ).ok );
assert.eq( 33, db.runCommand( {datasize:"test.jstests_datasize", min:{_id:'a'}, max:{_id:'z' }} ).size );
assert.eq( 16, db.runCommand( {datasize:"test.jstests_datasize", min:{_id:'a'}, max:{_id:'d' }} ).size );
assert.eq( 16, db.runCommand( {datasize:"test.jstests_datasize", min:{_id:'a'}, max:{_id:'d' }, keyPattern:{_id:1}} ).size );
assert.eq( 17, db.runCommand( {datasize:"test.jstests_datasize", min:{_id:'d'}, max:{_id:'z' }, keyPattern:{_id:1}} ).size );
assert.eq( 16, db.runCommand( {datasize:"test.jstests_datasize", min:{_id:'c'}, max:{_id:'c' }} ).size );
assert.eq( 0, db.runCommand( {datasize:"test.jstests_datasize", min:{_id:'a'}, max:{_id:'d' }, keyPattern:{a:1}} ).ok );