Closed maggie03230 closed 9 years ago
You mean .select
like querying? Sure just pass it as options.
I've been trying to pass select options like so:
Article.paginate(
{
status: 'active'
},
{
select: 'title teaser createdDate status _id slug',
page: page,
limit: limit,
sortBy: {
createdDate: -1
}
},
paginateCb
);
That doesn't seem to be working and I've tried a few variations on the select property, such as {title:-1}
. Am I missing something?
Oh just kidding, just got it working using the columns
property like so:
Article.paginate(
{
status: 'active'
},
{
columns: 'title teaser createdDate status _id slug',
page: page,
limit: limit,
sortBy: {
createdDate: -1
}
},
paginateCb
);
When I'm using mongoose, I can find and return the keys I need, just like: myModel.find(null,{name:true}) and the data come back will be[ {_id:xxx,name:xxx},{_id:yyy,name:yyy}] ……just like that. can mongoose-paginate also return specific keys I need?