Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sort populate field not working #142

Open
kodelio opened this issue Jun 8, 2018 · 1 comment
Open

sort populate field not working #142

kodelio opened this issue Jun 8, 2018 · 1 comment

Comments

@kodelio
Copy link

kodelio commented Jun 8, 2018

Hi,

I'm trying to sort my results with a field which is inside a populate :

let query   = {$or:[{name: { "$regex": params.search, "$options": "i" }}, {_id: { "$regex": params.search, "$options": "i" }}]};

let options = {
     offset: params.offset,
     limit: params.limit,
     populate: {
          path: '_id',
          options: {
              sort: {
                  'MktCapUSD': -1
               }
           }
     }
};

return Models.Asset.paginate(query, options).then(function (result) {
    return result;
}).catch((err) => {
    throw err;
});

But it's ignoring my sort query.

@Rathunter
Copy link

I am experiencing the same issue which makes me abandon this plugin and use Mongo's aggregate function instead. If this ever resolved please let me know.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants