mongoose-datatables
mongoose-datatables copied to clipboard
aggregation in mongoose-datatables
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/