Aah, totally forgot you can do that! You’re right; as of now, you’re not able to filter by the meta_title property.
/cc @DavidDarnes I think I might have found a bug or misuse (below) in the core relating to relations, should I escalate to gh?
The model base
parseOrderOptions pulls in a list of permitted attributes from the child modal, including allowed relations. This allows you to set the order to one of those relations, which kind-of breaks the API request. For example, ordering by authors asc will give you a 400, but title asc works perfectly fine, and potato asc succeeds because you can’t sort by potatoes, and therefore the order is ignored.
There’s also the question of if it should be possible to sort by one of the related columns - for example, as @Frank_Liu was asking, is
order="posts_meta.meta_title asc" a valid request? I know query-wise, that’s a bit more complicated, but I think it might be an unexpected regression from 2.x when the posts_meta table didn’t exist.
Here’s the error that Ghost logs:
[2020-04-09 02:28:28] ERROR "GET /ghost/api/v3/content/posts/?key=lol&order=posts_meta%20asc" 400 8ms
Could not understand request.
BadRequestError: Could not understand request.
at new BadRequestError (.../3.13.1/node_modules/ghost-ignition/lib/errors/index.js:113:23)
Error: SQLITE_ERROR: no such column: posts.posts_meta