Meteor: mini-mongo purging process

Viewed 40

I have a subscription:

        Meteor.subscribe(
            'FavCollection',
            Session.get('current_query'),
            Session.get("sortCollectionBy"),
            {
                onReady: function () {
                    console.log(FavCollection.find().fetch().length);
                }
            }
        );

If i change my session variable sortCollectionBy, the subscription gets renewed. In my publish function I limit the results to an amount of 100 documents. So in my FavCollection there should always be a maximum of 100 docs. But it is not.

The onReady fires when the new documents are inserted. So directly in my onReady-callback I have a maximum amount of 200 components. The purging process starts after(!) the subscription callback. But I need to know the moment when the Collection is purged from the old documents (the moment when there are 100 docs again in my collection). Is there a callback like waitForPurge or something? Am I missing a point and my understanding of this is wrong? Should I cancel the subscription and make a new (and load overlapping documents twice)?

0 Answers
Related