Custom query from code (sorting issue)

Sorry to resurrect an old thread! I’m having a similar issue with sorting. I’m trying to query content for a set of conditions and then sort the response alphabetically by a property.

This curl works

curl -X GET "https://cdn.builder.io/api/v3/content/location?apiKey=67d113c4afd947a7aa749b203e99ace6&query.data.population.$gte=5000&limit=10&sort.data.cityName=1" -H "accept: */*"

But this code does not. The response includes the queried data correctly but it is not sorted.

  const city = await builder.getAll("location", {
    options: {
      sort: {
        'data.cityName': 1
      }
  },
    query: {
      data: {
        population: { $gte: 50000 },
        stateAbbreviation: { $regex: params.state, $options: "i" }
      },
    },
  })

What am I doing wrong?

I was using v2 react SDK. Updating to latest fixed the sorting issue.