DZone Database Zone
Store a Function to Delete All Databases in MongoDB [Code Snippet]
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.
No comments:
Post a Comment