> db.yourCollection.runCommand("compact"); > db.runCommand({ compact : 'yourCollection' });