I have array of ids
ids = [1, 2, 3, 4, ...] #1000 ids
How I can use this function:
r.table("users").get_all(1, 2, 3, 4, ..1000 ids.., index: "id")
I can use
r.table("users").filter{ |doc| r.expr(ids).contains(doc["id"])}
But it is too slow on DB with 6 mln docs
methods taken here SQL to ReQL cheat sheet
To expand your ids
array into a list of arguments (that is expected by the get_all
method) use the splat operator (*array
) like this:
ids = [1, 2, 3, 4]
r.table('users').get_all(*ids, index: 'id') # note the `*`