Let's say I have a query like
Users.find().sort({score: 1}).limit(3)
which I publish on the server.
So, I have some code like this:
Meteor.publish("leaders", function () {
return Users.find().sort({score: 1}).limit(3)
});
Now, let's say, there is some change (insert/update/delete) in the Users
collection.
Are all the queries on that collection run again? or does Meteor run only certain queries whose results might actually change due to database change?
For example, a query that returns first three users Users.find().limit(3)
will return the same value even after new inserts, so re-running it will not have any effect.
Edit: I know that Meteor tails the Mongo oplog and propagates those changes to the clients, so I am not looking for an explanation on how it does realtime. More on the lines of, how(or whether) it tracks which queries are affected by a change.