Skip to content

Instantly share code, notes, and snippets.

View yoshikakbudto's full-sized avatar

Dmitry yoshikakbudto

  • Targem Games
  • Yekaterinburg city, Russia
View GitHub Profile
@yoshikakbudto
yoshikakbudto / mongodb_collection_sizes.js
Last active September 14, 2018 09:06 — forked from joeyAghion/mongodb_collection_sizes.js
List mongodb collections in descending order of size. Helpful for finding largest collections. First number is "size," second is "storageSize."
var mgo = new Mongo()
function getReadableFileSizeString(fileSizeInBytes) {
var i = -1;
var byteUnits = [' kB', ' MB', ' GB', ' TB', 'PB', 'EB', 'ZB', 'YB'];
do {
fileSizeInBytes = fileSizeInBytes / 1024;
i++;
} while (fileSizeInBytes > 1024);