diff --git a/Web/api/controllers/SurveysController.js b/Web/api/controllers/SurveysController.js index f9724d9..6bb4744 100644 --- a/Web/api/controllers/SurveysController.js +++ b/Web/api/controllers/SurveysController.js @@ -9,16 +9,7 @@ module.exports = { getQuestions: function (req, res) { var surveyId = req.param('id'); var jsonQuery = { "id": surveyId }; - //var jsonProjection = { - // id: true, - // questions: true, - // responses: true, - // userId: true, - // name: true, - // description: true, - // location: true, shortUrl: true, createdAt: true, updatedAt: true, - //}; - Surveys.findOne(jsonQuery, function (err, tempSurvey) { + Surveys.findOne(jsonQuery).populate('questions').exec(function (err, tempSurvey) { var survey = { id: tempSurvey.id, questions: tempSurvey.questions, @@ -30,7 +21,7 @@ module.exports = { createdAt: tempSurvey.createdAt, updatedAt: tempSurvey.updatedAt, }; - return res.send(JSON.stringify(survey)); + return res.send(JSON.stringify(survey)); }); } }