For my app I implemented the pagination using publish/subscribe with limit/skip. I also need the option to search for items, and for that task I am using matteodem:easy-search with the MongoDB searcher.
In my collection for each item I have:
id:
title:
description:
location:
I show let’s say 10 items, and when the user click on item’s title the complete item is shown (description, location, …) in a new page, using iron-router.
Now the problem: If I am searching after let’s say the title of one item, easy search will find the item and will show the results from mongodb collection, but when I click on that found item, of course sometimes, the description, location, … parts are missing because the item is not fetched yet in minimongo on client, maybe is not in the “LIMIT” items which are already on client.
With the _id of that item, when you click to go to the route of that item
waitOn: function () { subscribe('item', _id); }
And on your server
publish('item', function (id) {
return collections.item.findOne(id);
});
In summary, subscribe to a new publish that will return the specific item you are viewing separate from your search results. Going off discover meteor and the meteor docs, minimongo will merge same items so when you do collections.item.findOne(id) on the client side, it will be the one unique item but have all the fields now or what you published on the server.