Rethinkdb Select multiple rows from selection/sequence by array of row number -


for given sequence, how can fetch rows of row numbers(indices). know nth() can select nth index. if want select multiple rows index ?

r.expr([0, 10, 20, 30, 40, 50]).nth(3)    // gives 30 

the above works. but, how following ?

r.expr([0, 10, 20, 30, 40, 50]).nth([3, 5, 2])    // gives [30, 50, 20] 

you may better using slice:

selection.slice(startoffset[, endoffset, {leftbound:'closed', rightbound:'open'}]) → selection

the docs here.


Comments