0

I am working with this code link. Datatable is created but how can i use populate method with query. As according to provide code:

exports.getDataForDataTable = function getData (request, response)
{
  MyModel.dataTable(request.query, function (err, data) {
    response.send(data);
  });
};
Anshul
  • 116
  • 1
  • 10
  • possible duplicate http://stackoverflow.com/questions/17598712/how-should-i-properly-use-populate-with-mongoose – Asif Saeed Mar 07 '17 at 11:35
  • I am using datatable so i need syntax with datatable. Populate normally works but how it works with datatable syntax. – Anshul Mar 07 '17 at 11:45

1 Answers1

1

Add populate field in the request.query object

exports.getDataForDataTable = function getData (request, response)
{
   request.query.populate = 'Model';
   MyModel.dataTable(request.query, function (err, data) {
   response.send(data);
});
};
Asif Saeed
  • 1,985
  • 14
  • 24