U kunt uw query-object programmatisch opbouwen op basis van de selecties. Bijvoorbeeld:
var selections = [0, 1];
var query = { $or: [] };
for (var i=0; i<selections.length; i++) {
var selection = selections[i];
query.$or.push({
Category: Books.CatSelect[selection],
Pages: { $gte: Books.MinPages[selection] }
});
}
MyCollection.find(query).exec(function(err, result){
//...
}