当然可以.db.collection.stats().indexSizes
是一个嵌入式文档,其中每个索引名都是一个键,其值是以字节为单位的总索引大小:
> db.test.stats()
{
"ns" : "test.test",
<snip>
"indexSizes" : {
"_id_" : 137904592,
"a_1" : 106925728
},
"ok" : 1
}