While working on my gaming guild website, I needed to dump my Categories
collection and just reseed it. We are talking emptying gas cans and lighting a match style.
To remove a single item, we can pass in the id of the document to remove.
Categories.remove("uxccA7un7mjFmyqDn");
We can also remove all the items that match a query.
Categories.remove({ name: 'general' });
And to remove all the items? Well we just pass in an empty query so it matches everything!
Categories.remove({});
References
- https://teamgaslight.com/blog/how-to-remove-all-elements-from-a-meteor-collection
- http://stackoverflow.com/questions/23891631/meteor-how-can-i-drop-all-mongo-collections-and-clear-all-data-on-startup
- http://stackoverflow.com/questions/14947668/how-do-i-clear-the-collection-or-the-comments-and-names-on-the-screen-from-the-c