From 8dce99250b3fd28a02061399d1d1cc9bc266e532 Mon Sep 17 00:00:00 2001 From: barisusakli Date: Thu, 24 Jul 2014 12:41:22 -0400 Subject: [PATCH] final fix for #1884 fix mongo functions so they return correct data if duplicate keys are passed. getObjects(['post:1', 'post:1'], callback) was only returning one object. --- src/database/mongo/hash.js | 10 +++++----- src/database/mongo/helpers.js | 22 ++++++---------------- src/database/mongo/sorted.js | 5 +++-- 3 files changed, 14 insertions(+), 23 deletions(-) diff --git a/src/database/mongo/hash.js b/src/database/mongo/hash.js index f157342885..d116038bf9 100644 --- a/src/database/mongo/hash.js +++ b/src/database/mongo/hash.js @@ -20,17 +20,16 @@ module.exports = function(db, module) { }; module.getObjects = function(keys, callback) { - - db.collection('objects').find({_key:{$in:keys}}, {_id:0}).toArray(function(err, data) { - + db.collection('objects').find({_key: {$in: keys}}, {_id: 0}).toArray(function(err, data) { if(err) { return callback(err); } + var map = helpers.toMap(data); var returnData = []; for(var i=0; i