Description
I have just discovered that when I want to use a full-text search with ordering, only query.ascending('$score')
is working. query.descending('$score')
throws "Invalid field name: $score."
.
When you are doing a full-text search, you obviously want the results with a higher score first, so it should be descending
. But here's the thing - it actually returns the results in descending order.
It seems to be only a wording bug, but fixing it might be tricky because developers who are already using the query.ascending('$score')
for getting the descending results will not expect the change in future version.
Maybe the safest 'fix' would be to add a warning note to the docs that this wording mistake has been made and ignore it. Nobody will probably ever need (actually) ascending results anyway 😄
Tested on 2.8.4, 3.1.3, 3.2.3 in cloud code function