jaystack / odata-v4-mongodb

This server component lets you process OData requests over a MongoDB database
30 stars 22 forks source link

Filtering and ordering at the same time fails the sorting #3

Closed hasyee closed 7 years ago

hasyee commented 7 years ago

If I send a $filter=contains(Name,'c')&$orderby=UnitPrice request, the visitor looks like this:

{
  query: { Name: /c/gi },
  sort: { NameUnitPrice: 1 },
  ...
}

And if I send a $filter=contains(Name,'c')&$orderby=Name request, the visitor is:

{
  query: { Name: /c/gi },
  sort: { NameName: 1 },
  ...
}

It works fine if I skip the $filter or the $orderby: $orderby=UnitPrice or $filter=contains(Name,'c')