A query defines a set of conditions on a collection of documents. Most of the time, only the documents that meet these conditions need to be published to the client. In many cases the query's conditions are subject to the state of the application (for instance the selected sorting field). This pattern describes how to update your query's result set reactively with meteor without losing the cursor's state. This way, results are preserved over different adjustements of a query if they meet both set of conditions.
To illustrate this pattern best, we'll be using the following example case throughout.
Let's say you have a collection of Players
and a collection of Games
. We track each score in a Scores
collection. Some example data:
Players: