mongoose-datatables icon indicating copy to clipboard operation
mongoose-datatables copied to clipboard

aggregation in mongoose-datatables

Open mohidkazi opened this issue 5 years ago • 0 comments

Hi, i am really confused as i want to use aggregate pipeline with mongoose-datatables. This is my code aModel.dataTables({ find: {isCertified: { $ne: null}}, limit: req.body.length, skip: req.body.start, search: { value: req.body.search.value, fields: ['status', 'user'], andQuery: andQuery, }, sort: { [req.body.columns[req.body.order[0].column].data]: dir }, populate: [ { path: 'user' } ] }) What i want is to do a left join something like this db.orders.aggregate([ { $lookup: { from: "products", localField: "products", foreignField: "_id", as: "productObjects" } } ]) my question is can i use aggregate with mongoose-datatables? if yes, then how can i use it ? if no, then are there any other method to do something like this/

mohidkazi avatar Jul 23 '19 15:07 mohidkazi