From 1609221d77bdf820834f9d0300c388ec02d1b3c7 Mon Sep 17 00:00:00 2001 From: arnaucode Date: Sat, 18 Feb 2017 12:16:53 +0100 Subject: [PATCH] events populate --- controllers/eventController.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/controllers/eventController.js b/controllers/eventController.js index b6dc0d6..cfd7cec 100644 --- a/controllers/eventController.js +++ b/controllers/eventController.js @@ -11,6 +11,8 @@ var pageSize=config.pageSize; exports.getAllEvents = function(req, res) { eventModel.find({date: {$gte: new Date()}}) + .lean() + .populate('user', 'username') .sort('date') .limit(pageSize) .skip(pageSize * Number(req.query.page)) @@ -22,7 +24,7 @@ exports.getAllEvents = function(req, res) { exports.getEventById = function (req, res) { eventModel.findOne({_id: req.params.eventid}) .lean() - .populate('user', 'username avatar telegram phone') + .populate('user', 'username img description') .exec(function (err, event) { if (err) return res.send(500, err.message); if (!event) {