Hi everyone!
Im trying to set up a sort for an api response (using qs to build). I’m familiar with deep sorting and have set this up successfully. However, I need to filter one specific call based on the presence or absence of a field.
Is this possible with the initial api call, or is it something only possible with js sorting on the response?
For instance:
An object could be either of the below:
{
prop1:"some value"
sortprop:"some value"
}
{
prop1:"some value"
}
How would I write the sort in the qs query so all objects not containing sortprop are moved to the start and those with sortprop to the end? I have tried:
sort:["sortprop"]
sort: [
{
field: "sortprop",
order: "asc",
nulls: "always",
},
],
Neither work! I know a js solution after the response is possible, but would be neat to do it in one go if possible.