Mongo cheatsheet

  • removing records doesn’t free any storage space unless you compact those collections

      db.runCommand({compact: '< collection >'})
    
  • get collection stats, e.g., size, index-size, records, and a lot more

      db.runCommand({ collStats: '< collection >', scale: 1024*1024 })
    

    scale means display in 1024*1024 bytes (or MB) instead of bytes