diff --git a/lib/index.js b/lib/index.js index 188eac0..200a055 100644 --- a/lib/index.js +++ b/lib/index.js @@ -36,7 +36,23 @@ engine.getData = function (startDate, endDate, callback) { } }, {$sort: {"_id.year": 1, "_id.month": 1, "_id.day": 1}} - ], callback); + ], function (err, data) { + if (err) { + callback(err); + return; + } + + var result = []; + for (var i = 0; i < data.length; i++) { + var d = data[i]; + result.push({ + date: new Date(d._id.year, d._id.month, d._id.day), + value: d.hits + }); + } + + callback(null, result); + }); }; module.exports = engine; \ No newline at end of file