summaryrefslogtreecommitdiff
path: root/jstests/mmap_v1/stats.js
blob: 9d1e95773b70fd2c5f01ff4da91719e3aab2c296 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23

var statsDB = db.getSiblingDB("stats");
statsDB.dropDatabase();
var t = statsDB.stats1;

t.save({a: 1});

assert.lt(0, t.dataSize(), "A");
assert.lt(t.dataSize(), t.storageSize(), "B");
assert.lt(0, t.totalIndexSize(), "C");

var stats = statsDB.stats();
assert.gt(stats.fileSize, 0);
assert.eq(stats.dataFileVersion.major, 4);
assert.eq(stats.dataFileVersion.minor, 22);

// test empty database; should be no dataFileVersion
statsDB.dropDatabase();
var statsEmptyDB = statsDB.stats();
assert.eq(statsEmptyDB.fileSize, 0);
assert.isnull(statsEmptyDB.dataFileVersion);

statsDB.dropDatabase();