Deleting everything in a test MongoDB is a common operation for test and dev machines. It's a relatively simple operation that I have described here. After a little while, I got really tired of searching for the little script that deletes everything every time I needed it. Thus, I decided to store it inside the admin database.

The solution is really simple. Just connect to the admin database and register a server-side function to delete all databases.