query change

v1.18.x
barisusakli 11 years ago
parent 0c8c6632d9
commit 8b4c61241f

@ -72,7 +72,15 @@ module.exports = function(db, module) {
count = 0;
}
db.collection('objects').find({_key:key, score: {$gte:min, $lte:max}}, {fields:{value:1}})
var scoreQuery = {};
if (min !== -Infinity) {
scoreQuery['$gte'] = min;
}
if (max !== Infinity) {
scoreQuery['$lte'] = max;
}
db.collection('objects').find({_key:key, score: scoreQuery}, {fields:{value:1}})
.limit(count)
.skip(start)
.sort({score: sort})

Loading…
Cancel
Save