|
|
|
@ -23,7 +23,10 @@ module.exports = function(db, module) {
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
module.getObjects = function(keys, callback) {
|
|
|
|
|
helpers.checkKeys(keys);
|
|
|
|
|
if (keys.length > helpers.KEY_LIMIT) {
|
|
|
|
|
var e = new Error('too many keys');
|
|
|
|
|
winston.warn('[HASH - TOO_MANY_KEYS] ' + keys.length + ' ' + keys[0] + ' ' + keys[keys.length - 1] + '\n', e.stack);
|
|
|
|
|
}
|
|
|
|
|
db.collection('objects').find({_key: {$in: keys}}, {_id: 0}).toArray(function(err, data) {
|
|
|
|
|
if(err) {
|
|
|
|
|
return callback(err);
|
|
|
|
@ -54,7 +57,11 @@ module.exports = function(db, module) {
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
module.getObjectsFields = function(keys, fields, callback) {
|
|
|
|
|
helpers.checkKeys(keys);
|
|
|
|
|
if (keys.length > helpers.KEY_LIMIT) {
|
|
|
|
|
var e = new Error('too many keys');
|
|
|
|
|
winston.warn('[HASH - TOO_MANY_KEYS] ' + keys.length + ' ' + keys[0] + ' ' + keys[keys.length - 1] + '\n', e.stack);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var _fields = {
|
|
|
|
|
_id: 0,
|
|
|
|
|
_key: 1
|
|
|
|
|