Reputation: 707
Is there a way to order the output of a getAll query in rethinkdb by the input order of the args?
I try to do following:
r.db('aDatabase').table('aTable').getAll(r.args([3,2,4,1]))
Because I added the items in the order 1, 2, 3, 4 I also get them back in that order. But I would like to get them in the order specified in the query (3,2,4,1).
Is there a way to make rethinkdb respect the way I ordered my input arguments or do I have to order them manually afterwards?
By the way: the above ids are only an example and are in reality uuids.
Upvotes: 0
Views: 181
Reputation: 5289
You can write r.expr([3, 2, 4, 1]).concatMap(function(id) { return TABLE.getAll(id); })
, but it will be a little slower.
Upvotes: 1