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
Nice catch! I use it but never really thought about it, it is descending
@rihadavid any interest in taking this on?
Steps I'd think we'd need:
Ideally, we could find some 'new way' to do it right query.ascendingScore()/query.descendingScore()
is the terrible first thing that comes to mind, so we don't have to deal with any blast radius by actually breaking it.
In the future, we could then decide to no longer support '$score' passed in...
@acinader thanks for the suggestions, unfortunately, reporting bugs is the best I can do at the moment, working 12 hours a day on my startup 馃檲
@acinader - is this open ? Hunting good-first issues
@iamvajid this one is still open. A PR will be very welcomed.
Thanks @davimacedo , i will give it a try
Most helpful comment
@acinader - is this open ? Hunting good-first issues