I don’t think your doing it right, you would need to have two different collections defined.
You’ve used BlogPosts for both. The more recent subscription will likely overwrite the older one (not certain if that is how it works). You’ve got two subscriptions to the same collection.
I’ve never done this myself, but I think what you want to do is define two BlogPosts objects.
Note: the user of Meteor.userId() and also the fetch() to convert the cursor to an array.
What the publish does is, give you a superset of rows you’ll need on the client.
Then on the client, you are querying minimongo to retrieve and format the data for presentation in your templates.
EDIT:
On the server, you want to return a cursor because this is reactive and your cilent helper will be kicked off each time this cursor changes. But on the client a cursor is not a list, so you must resolve it into an array via fetch before you can use it.
You can have more than one subscription on the same collection, but need to know that it will be merged (look up merge box) on the client. In order to tease apart the data from your two subscriptions you need to use a query in your helper
Maybe I don’t understand what you mean, but generally speaking you should avoid converting a cursor to an array when returning it from a helper, as Blaze (the rendering package) performs better with a cursor. See here.
@markpdev steve is right, don’t resolve your result via fetch, I got the wrong impression somewhere along the line for some other problem. In fact, I also just return cursors in my helper! Thanks @Steve for picking it up.
The “best-practice conclusion” for me (as a newbie) is:
Just make one publish and one subscription per Collection
and just lowercase name it with the Collection name.
Everything else (have 2 publications of the same collection) is going to make the code less readable
and harder to debug.
Am I right? Or is there a use-case where it makes sense to have 2 publishs of the same Collection?