Meteor keeps publishing a collection I do not want it to


#1

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


#3

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


#4

You said you grep-ped your code for ‘testCol’. Can you grep it for ‘subscribe’ or ‘publish’ maybe you can catch it somewhere ?


#5

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


#6

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.


#7

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:


#8

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.


#9

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?