3 var persistence
= require('gitter-web-persistence');
4 var cacheWrapper
= require('gitter-web-cache-wrapper');
7 * fetchByTags() retrives rooms that match a given set of tags
9 * tags Array the querying tags
10 * @return Promise promise of matching rooms
12 function fetchByTags(tags
) {
13 // limit by 8 tags to avoid mega queries
14 tags
= tags
.slice(0, 8);
16 return persistence
.Troupe
.find({
22 .sort({ userCount
: -1 })
27 exports
.fetchByTags
= fetchByTags
;
29 exports
.fetchByTagsCached
= cacheWrapper('fetchByTagsCached', fetchByTags
);