diff --git a/handlers/dataHandlers.js b/handlers/dataHandlers.js index f14c2b1..d89b280 100644 --- a/handlers/dataHandlers.js +++ b/handlers/dataHandlers.js @@ -349,15 +349,20 @@ Mark.updateMarksLabel = function(req, res, next) { }; Mark.pointList = function(req, res, next) { - var query = req.query; - delete query.token; - mongoDB.find("camic", 'mark', query, { x: 1, y: 1, _id: 0 }).toArray().then((points) => { - req.data = { points: points.map(point => [point.x, point.y]) }; + var query = req.query; + delete query.token; + var points = []; + + mongoDB.find("camic", 'mark', query, { x: 1, y: 1, _id: 0 }).forEach((doc) => { + points.push([doc.x, doc.y]); + }).then(() => { + req.data = { points: points }; next(); - }).catch((e) => next(e)); + }).catch((e) => next(e)); }; + var Heatmap = {}; Heatmap.types = function(req, res, next) { var query = req.query;