Skip to content

Sort returns HTTP 500 for some fields (all /movie fields, quote.dialog, character.race, …) #228

Description

@nickakey

Summary

Sorting via the documented ?sort=field:asc|desc syntax returns 500 {"success":false,"message":"Something went wrong."} for many fields — including every field on /movie and /quote?sort=dialog. It succeeds only for a few fields (e.g. character.name, book.name). Filtering, pagination, and non-sorted requests on the same endpoints all work (200).

Reproduction

All requests use a valid Authorization: Bearer <key>. Base URL https://the-one-api.dev/v2.

Request Status
GET /movie?limit=2 (no sort) 200 ✅
GET /movie?academyAwardWins>=1 (filter) 200 ✅
GET /character?sort=name:asc 200 ✅
GET /book?sort=name:asc 200 ✅
GET /movie?sort=name:asc 500 ❌
GET /movie?sort=runtimeInMinutes:asc 500 ❌
GET /movie?sort=boxOfficeRevenueInMillions:desc 500 ❌
GET /quote?sort=dialog:asc 500 ❌
GET /character?sort=race:asc 500 ❌

Ideas for fix

Claude is suggesting checking if you have indexes on the fields that ARE working (e.g. character.name) and that maybe you need indexes for the other vals as well. I'm not a MongoDB guy so not sure

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions