Skip to content

aggregation in mongoose-datatables #20

@mohidkazi

Description

@mohidkazi

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/

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions