I have a list of posts visually displayed. Each post is sorted by its votes.
Posts.find({}, {sort: {votes: -1, name: 1}})
Now when a user clicks upvote on a post, I do a
Posts.update(id, {$inc: {votes: 1}});
Now since it is sorted by votes, the item moves up/down in the list and the user looses the context. He has to search for the item where it has moved to.
How do I tell meteor to not move the item on update?
I checked the Collections.update function, it doesn’t support reactive: false
You have to use the
reactive:falsein the find method (it passes on the data to handlebars).So that it doesn’t listen for updates (insert/update/move/delete)
If you need to customize it so that its only for the update operation:
For starters you would need to remove the
autopublishpackage.You also need to then subscribe to your collections manually and publish them from the server. The parties example shows how to do this quite well.
Then you would need to write a custom publish function and alter the
changed:function so that it doesn’t send any data down to the client when votes changes. Note though that the user will not see the updated number of votes until they refresh the page