Mongo collection not syncing; React, Collections

I am going through the Meteor React tutorial and am on section 3, collections.
https://www.meteor.com/tutorials/react/collections

As far as I can tell, the code I am using is exactly the same as the tutorial. However, the client does not display data from the server-side Mongo collection. That is, on the client Tasks.find().fetch() returns an empty array, and on the server Tasks.find.fetch() returns all data from the Mongo collection. There are no errors or other indications that anything is wrong, other than the fact that the client side Tasks collection seems to be empty.

There does not seem to be any import problems, as the collection looks fine on the server side. The client simply seems to have no access to the mongo server data.

I am using Meteor 1.5.2.1 running on Mac OS X. The browser is Chrome.

Any ideas on how to troubleshoot this?

Sounds like an issue with publish or subscribe. It could also be that the guide expects you to have the autopublish package installed, which maybe you don’t have? (It’s only intended for learning/testing purposes)

1 Like

Thanks - I just installed autopublish, but still no luck.
meteor npm install --save autopublish

Is there some way to monitor or inspect status for data requests? How can I tell if it is actually trying to request data from the server? (Or does the server push the data?)

Yeah, the tutorial seems to assume that the autopublish package is installed so that all data gets automatically pushed to the client. As far as I know this should be the case unless it was manually removed or the project was created with the --bare flag.

It should be meteor add autopublish - that installs it from Atmosphere, Meteor’s own package repository. Autopublish on npm is something different.

But yeah, you most likely already have it. You can see what atmosphere packages you have installed in the .meteor/packages file.

Success! I did a meteor add autopublish and now it works.

Hooray! In the next chapter they’ll probably tell you to remove it :stuck_out_tongue:

2 Likes