Skip to content

Latest commit

 

History

History
30 lines (24 loc) · 697 Bytes

README.tricks.md

File metadata and controls

30 lines (24 loc) · 697 Bytes

Quicly clean all your files with prettier

#
npm install prettier
npx prettier --write ./server/**/*.js
npx prettier --write ./src/app/**/*.ts
npx prettier --write ./src/app/**/*.html
npx prettier --write ./src/app/**/*.scss

MongoDB

List all collections and their sizes

var collectionNames = db.getCollectionNames();
var stats = [];

collectionNames.forEach((n) => stats.push(db[n].stats()));
var statsSorted = stats.sort((a, b) => a.size < b.size);

for (var c in statsSorted) {
  const gbRaw = stats[c]["size"] / 1024 / 1024 / 1024;
  const gb = gbRaw.toFixed(2);
  print(stats[c]["ns"] + " - " + stats[c]["count"] + " items");
  print(gb + " Gb");
  print("");
}