`const {pageIndex, pageSize, sortField, sortOrder, filters} = data;
return Voter.aggregate([
{
$match: {
isVoterVerified: false
},
$facet: {
metadata: [{$count: "total"}, {$addFields {page:pageIndex}}],
data: [
{
$sort: {
[sortField || "createdAt"]: sortOrder || -1,
},
},
{$skip: (pageSize * (pageIndex - 1)) || 0},
{$limit: pageSize},
],
},
}
]).exec();`
I want to get all of the entries based on "isVoterVerified = false" and add pagination. when I run on postmen or in web client, I get a error saying "bad request". However, if I remove one of the stages and run it works perfectly fine.
I want to match the entries "isVoterVerified = false" and add pagination.
Thank You.
Any solutions for this problem will be appreciated.
Via Active questions tagged javascript - Stack Overflow https://ift.tt/gBhXkJi
Comments
Post a Comment