summaryrefslogtreecommitdiff
path: root/jstests/datasize.js
blob: 402be703a04c67e232eb802a48b9cf36fe72529e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
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( 0, db.runCommand( {datasize:"test.jstests_datasize", min:{_id:'a'}, max:{_id:'d' }, keyPattern:{a:1}} ).ok );