How do you unpublish a collection?


#1

When I want to pass data from the server to the client and this data takes a long to compute, I create a temporary collection, publish it, subscribe from the client and populate the collection from a method.

The advantage over just a method is the template re-renders on change and the user has the feeling of a ‘progressive update’ which is much better than waiting in front of a spinning hourglass for 10 minutes. Also you can switch pages and come back.

Say the user is happy with the result and saves it. How do I unpublish the collection ?

Trying to overwrite the publication with something that doesn’t return anything doesn’t work because meteor ignores it with the message “Ignoring duplicate publish named [name]”

Also, any suggestion on a better way to implement the “progressive update on long server side computation” feature ?


#2

Run your method on setInterval and grab data from server incrementally, in small batches. E.g. the amount necessary to fill one screen. That way user will have the impression that all the data is already there.


#3

What I did is a local collection created in a template. The collection is fed by an autorun which reads a client-server collection.

The complex computations are done in a server side method that saves them in the client-server collection.
Then the autorun gets called and it updates the local collection which directs the rendering