I get an application that displays a list of item. A list is a document An item is a document that has a listId Each item may have an itemImage (using collectionFs)
On the page i have some subscriptions. Some of them are 2 counters of the current list based on the total of item in db (which is not the same than total of item displayed) and the total of item that has some special status.
When the user remove all those items it sends a Meteor.call('remove', listId)
to the server.
On server the methods called doesn't remove items directly but it loops over the list using a
items.find({listId: listId}).forEach()
And inside the foreach
I remove documents from itemImage
Collections
If there is more than 1000 items (dev server) then it blocks the interface because : the counters displayed are decremented in real time (nearly). When the server has finished then all pending subscriptions are run. So during this pending time the user is blocked.
I tryed to stop subscription on counters, but i don't succeed.
Maybe my application is badly thought. What is the solution ? modify the mongoDb (but in which way ?) or managing in another way the subscriptions ?
I still want to get the counters reactive, because it's a better feeling for user when there is new item saved in mongo. But when i do remove, in fact, it's almost useless. Thanks