short answer:
r.expr([id1, id2, id3]).eqJoin(function(doc) { return doc; }, r.table("person"))
Longer answer:
There are several ways to do this. Above was what I would call the canonical path. Let what happens is broken down:
First r.expr([id1, id2, id3]) we collect an array to send it to the server.
Then we call eqJoin what it does is take a stream of values ββand send and index get for each of them. function(doc) { return doc; } function(doc) { return doc; } is a slightly ugly hack because eqJoin requires a display function.
Thus, the above code becomes equivalent:
[r.table("person").get(id1), r.table("person").get(id2), r.table("person).get(id3)]
Joe doliner
source share