Syntax

table.getAll(key1, key2, ..., keyN) → cursor

Arguments

List of arguments to provide.
keys
string
required
One or more primary key values to retrieve documents for. Keys must match the type of the primary key or specified index field.

Optargs

No optional arguments.

Returns

cursor
Cursor
Returns a cursor pointing to the sequence of documents that match the provided keys.

Behavior

  • If a key doesn’t match any document, it is silently omitted from the results.

Notes & Caveats

  • Duplicate keys in the input will result in duplicate documents in the output.
  • Non-existent keys are ignored without throwing errors.

Example

Get multiple users by ID

Retrieve several users by their primary keys.
const cursor = await r.table('users').getAll('user_1', 'user_2', 'user_3').run(client);
const users = await cursor.toArray();

console.table(users);
  • get - Get a single document by primary key
  • filter - Filter documents by conditions
  • table - Reference a table

Found a typo? Or maybe a broken link? RuloDB is open-source, help us fix it!