Reputation: 8481
I want to do something like the following:
r.db('mydb').table('tab').between(
['s', 0],
['s', 99999], {index: r.desc('s-t')})
but this is not a correct Rql query:
RqlCompileError: DESC may only be used as an argument to ORDERBY. in:
Can I safely use
r.db('mydb').table('tab').between(
['s', 0],
['s', 99999], {index: 's-t'}).orderBy({index: r.desc('s-t')})
Will it be executed optimally (using single read instead of reading all records and then sorting them?
Upvotes: 1
Views: 680
Reputation: 4353
Yes, if you chain a between
command with an orderBy
one (using the same index), it will be executed in an efficient way.
Upvotes: 1