I\'m having a few problems when trying to get data from a Meteor Collection and I need some advice.
The collection has been defined, published, and subscribed successful
I recently had the same problem,
The collection find() returned nothing when used from a query.observe
.
The problem was the order of the subscribe
of collections.
For example if you have a collection called Lists
and one called Projects
,
If you're getting the projects by observing a query on lists, and you had :
Meteor.subscribe('Lists');
Meteor.subscribe('Projects');
What happens is the query observe trigger is called, but the Projects are not yet fetched from the server. So Projects.find().fetch().length = 0.
To fix it, simply do
Meteor.subscribe('Projects');
Meteor.subscribe('Lists');