I'm using GeddyJS framework for a NodeJS application.
I got stuck with a problem in setting limit while making a call to all() method in any model.
I tried providing limit as one of the option but its not working as expected.
geddy.model.User.all({userId: 1}, {sort:{createdAt: "desc"},limit:10}, function(err,data){
Any Help???
PS: We are using MongoDB as database.
This is what you're looking for I think:
geddy.model.User.all(
{},
{sort: {createdAt: 'desc'}, limit: 10},
function (err, data) {
// do stuff
}
);
If this isn't working for you, let us (the framework devs) know what error your getting.
I don't see anything in the docs about using limit; however, this might work for you.
geddy.model.User.all(
{userId: 1},
{sort:{createdAt: "desc"}},
{limit:10},
function(err, data){
// do stuff
})