Meteor keeps publishing a collection I do not want it to

Hi,

before you ask - autopublish is not installed :smile:
But I have a Collection I define on the server ie: @TestColl = new Meteor.Collection(ā€˜testCollā€™);
I do not publish this collection (well, not explicit, anyway), I do /not/ subscribe to it - but still I can query it! I can do TestColl.find().count() and I can see all the recordsā€¦ why?

By all accounts, I should (with autopublish not installed!) publish and subscribe to it. I do not - but I can still see itā€¦ Iā€™ve grep-ped my source for any hidden lines that contains ā€œtestColā€, all to no avail.

Iā€™ve been banging my head against this wall for a few days now, so any insight will be much appreciated!

regards,

Paul

Not sure if it has to do with the issue but, it should be new Mongo.Collection("..."); you are using a dedicated method.

1 Like

You said you grep-ped your code for ā€˜testColā€™. Can you grep it for ā€˜subscribeā€™ or ā€˜publishā€™ maybe you can catch it somewhere ?

When you say you can query it, are you saying you can do that on the client? And what do you mean by

If youā€™ve defined the collection on the server, you shouldnā€™t be able to see it on the client. TestColl should be undefined. If youā€™re querying from the server, you donā€™t need to subscribe at all. Itā€™l just work.

Hi Everybody,

thanks for your answers - I was on another project for a few days; hence the silence :smile:

@entropy: this should not make a difference: stackoverflow about this very same issue; but thanks for the pointer!

@yasinuslu: if I grep for subscribe, of course I find other collections - but not this oneā€¦

@jamgold: yep - on the clientā€¦ that is why I am confused :smile:

@mnmtanish: exactly. That is my problem! :laughing:

I think I figured it out though; my conception of Collections/subscriptions was not yet complete.

The collection(name) is independent of the name of the subscription. My conception was that the collection defined on the server in combination with the publication would make a ā€œnew collectionā€ on the client.
The way I understand it now is that you have a collection in Mongo. You have a collection on the client. And subscriptions will (using what ever name) dump data in the clientside collection. Hence the fact that several partial subscriptions get thrown in the same collection client-side.
Iā€™m obviously still working my way through this :slight_smile:

1 Like

That is correct. The name of the subscription is simply the handle used for pub/sub. You can publish data from the server that isnā€™t even in a collection. Or you can aggregate several collections into a publication. The client will be able to access data published via minimongo. Meteor takes care of synchronizing/pushing the data to the client.

Thanks for the even further clarification. It feels like Iā€™ve got a Meteor-strike on my head :smile:

Iā€™m also trying to find out how/when the synchronisation takes place, but I cannot really find any conclusive answer. How can I be sure that the sync took place / mongo on the server has recieved and stored any data Iā€™ve send to it?