Is it possible to generate "subcollections"?


#1

Here’s the idea. I am using alanning:roles and aldeed:simple-schema in order to create a user based system. The problem is that often this has the potential to get very large, but I divide it up in queries in common and uniform ways. For example, take the following routes:

"/game/:gameId/players" => Roles.getUsersInRole('player', this.params.gameId);
"/game/:gameId/admins" => Roles.getUsersInRole('admin', this.params.gameId);

What I am wondering is if there is a more “scalable” solution; for example, to have a “pseudo-collection” that doesn’t necessarily exist on its own, but is a more manageable proxy to my users collection. Eg, Players is a subset of Meteor.users such that it is the result of Roles.getUsersInRole('player')


#2

You could create a client side collection and publish whatever you want to it. You can then denormalize your data however you see fit. Client side collection only exist on the client so they are in a sense a “pseudo-collection.”