Skip to content

Commit

Permalink
Merge into engines expected format
Browse files Browse the repository at this point in the history
  • Loading branch information
dwnz committed Oct 7, 2014
1 parent 0b2f447 commit fb32fd9
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;

0 comments on commit fb32fd9

Please sign in to comment.