My understanding is that you create references / subscriptions inside the current model to various store elements. So, on a page that I have multiple lists of information coming from different collections in mongo I have several calls to:
model.subscribe and then model.refList. So, for instance, on one page where I'm pulling several different types of information I have the following (note, I'm using Step because sometimes I hate all the nesting):
get('/', function(page, model) {
step(function subscribeSites() {
model.subscribe('sites', 'users.1.sites', this);
},
function subscribeServers(err, sites) {
if (err)
throw err;
model.refList('_sites', sites, 'users.1.sites');
model.subscribe('servers', 'users.1.servers', this);
},
function subscribeMessages(err, servers) {
if (err)
throw err;
model.refList('_servers', servers, 'users.1.servers');
model.subscribe('messages', 'users.1.messages', this);
},
function renderHome(err, messages) {
if (err)
throw err;
model.refList('_messages', messages, 'users.1.messages');
render('home', page);
});
})
What this does is create attributes in the model for _sites, _servers and _messages that pull the information from the appropriately named collections (e.g. sites, servers, messages) and that have referenced lists of content for the user in a collection called users. So the users collection has the following: { "_id" : "1", "sites" : [ "6aee61ed-4631-4b81-807b-aa47d2223798" ] }