How to remove collection document, when removing a package?

I’d like to remove a document inside a collection when I remove a package. The code to remove the document should be inside the package. Any idea how to go about it?

Many thanks.

I don’t think the meteor tool has any hooks for this - you’d have to read the package code and remove it programatically.

You could also maybe create a temporary collection and store the document there, then attach it to some object known by the app:

var Package = new Mongo.Collection(null);

PackageCollections.Package = Package;