获取MongoDB中所有集合的大小(Gets the size of all collections in mongodb)

https://blog.csdn.net/ruanjiana051/article/details/84588664?spm=1001.2101.3001.6650.6&utm_medium=distribute.pc_relevant.none-task-blog-2%7Edefault%7EBlogCommendFromBaidu%7Edefault-6-84588664-blog-104928526.pc_relevant_default&depth_1-utm_source=distribute.pc_relevant.none-task-blog-2%7Edefault%7EBlogCommendFromBaidu%7Edefault-6-84588664-blog-104928526.pc_relevant_default&utm_relevant_index=8

var collNames = db.getCollectionNames();
for (var i = 0; i < collNames.length; i++) {  
    if (collNames[i].indexOf("不想要的表")> -1)continue;
  var coll = db.getCollection(collNames[i]); 
  var stats = coll.stats(1024 * 1024); 
  print("|name:",stats.ns,"|size:", stats.storageSize,"|count:",stats.count);
   
}
————————

https://blog.csdn.net/ruanjiana051/article/details/84588664?spm=1001.2101.3001.6650.6&utm_medium=distribute.pc_relevant.none-task-blog-2%7Edefault%7EBlogCommendFromBaidu%7Edefault-6-84588664-blog-104928526.pc_relevant_default&depth_1-utm_source=distribute.pc_relevant.none-task-blog-2%7Edefault%7EBlogCommendFromBaidu%7Edefault-6-84588664-blog-104928526.pc_relevant_default&utm_relevant_index=8

var collNames = db.getCollectionNames();
for (var i = 0; i < collNames.length; i++) {  
    if (collNames[i].indexOf("不想要的表")> -1)continue;
  var coll = db.getCollection(collNames[i]); 
  var stats = coll.stats(1024 * 1024); 
  print("|name:",stats.ns,"|size:", stats.storageSize,"|count:",stats.count);
   
}