1

Have some ids:

let uIds = ['2e56c685-977b-41df-95dd-6adab3aef009', 
  'dc636c8c-46b8-4022-bea8-a17e692e75ce'
  ];

How to get all records with these ids?

This doesn't work:

r.db('test').table('users').getAll(uIds)   

And this too:

r.db('test').table('users').getAll.apply(this, uIds)

And even this:

r.db('test').table('users').getAll(r.expr(uIds))
Maksim Nesterenko
  • 5,661
  • 11
  • 57
  • 91

1 Answers1

2

You can use r.args to splice arguments:

.getAll(r.args(uIds))

If those arguments are known when building the query, you can also use apply , but it must be called with the proper this argument:

var table = r.table('users');
table.getAll.apply(table, uIds)
Etienne Laurin
  • 6,731
  • 2
  • 27
  • 31