Drop collection from database


#1

Is it possible to drop a collection on server startup? I can’t find anything about dropping a collection. Not just empty a collection, but actually delete it.


#2

In server-side code, for a collection named foo, I believe you should be able to do something like this:

new Mongo.Collection('foo').rawCollection().drop();

Hope that helps!


#3

Getting an error when trying that.

Error: There is already a collection named “mycollection”


#4

I ended up using the values these collections where setup with. Seems to work ok.

Meteor.users.rawCollection().drop();
ServiceConfiguration.configurations.rawCollection().drop();

Thanks for the help @natedaly