From e2707353e996a8185fc099e336b0392627d03eaa Mon Sep 17 00:00:00 2001 From: barisusakli Date: Sat, 20 Sep 2014 16:05:52 -0400 Subject: [PATCH] dont return unnecessary data --- src/database/mongo/sets.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/database/mongo/sets.js b/src/database/mongo/sets.js index 78e501cbd9..ae9275db50 100644 --- a/src/database/mongo/sets.js +++ b/src/database/mongo/sets.js @@ -98,7 +98,7 @@ module.exports = function(db, module) { module.isSetMember = function(key, value, callback) { value = helpers.valueToString(value); - db.collection('objects').findOne({_key:key, members: value}, function(err, item) { + db.collection('objects').findOne({_key:key, members: value}, {_id: 0, members: 0},function(err, item) { callback(err, item !== null && item !== undefined); }); }; @@ -108,7 +108,7 @@ module.exports = function(db, module) { values[i] = helpers.valueToString(values[i]); } - db.collection('objects').findOne({_key:key, members: {$in : values}}, function(err, items) { + db.collection('objects').findOne({_key: key, members: {$in : values}}, {_id: 0, _key: 0}, function(err, items) { if (err) { return callback(err); } @@ -125,7 +125,7 @@ module.exports = function(db, module) { value = helpers.valueToString(value); - db.collection('objects').find({_key: {$in : sets}, members: value}).toArray(function(err, result) { + db.collection('objects').find({_key: {$in : sets}, members: value}, {_id:0, members: 0}).toArray(function(err, result) { if(err) { return callback(err); } @@ -143,13 +143,13 @@ module.exports = function(db, module) { }; module.getSetMembers = function(key, callback) { - db.collection('objects').findOne({_key:key}, {members:1}, function(err, data) { + db.collection('objects').findOne({_key: key}, {members: 1}, {_id: 0, _key: 0}, function(err, data) { callback(err, data ? data.members : []); }); }; module.getSetsMembers = function(keys, callback) { - db.collection('objects').find({_key: {$in: keys}}, {_key: 1, members: 1}).toArray(function(err, data) { + db.collection('objects').find({_key: {$in: keys}}, {_id: 0, _key: 1, members: 1}).toArray(function(err, data) { if (err) { return callback(err); } @@ -167,7 +167,7 @@ module.exports = function(db, module) { }; module.setCount = function(key, callback) { - db.collection('objects').findOne({_key:key}, function(err, data) { + db.collection('objects').findOne({_key: key}, {_id: 0}, function(err, data) { return callback(err, data ? data.members.length : 0); }); };