Syntax

r.tableList() → cursor
r.db(dbName).tableList() → cursor

Arguments

No arguments.

Optargs

No optional arguments.

Returns

cursor
cursor<string>
Returns a cursor pointing to an array of table names within the specified database.

Behavior

  • Lists all tables in the specified database (or default database if not specified).
  • Returns table names as strings in alphabetical order.
  • If the database is empty (no tables), returns an empty array.

Notes & Caveats

  • Table names are returned as strings, not table references.
  • The order of table names is consistent (alphabetical).

Example

List tables in default database

Get all tables from the default database.
const cursor = await r.tableList().run(client);
const tables = await cursor.toArray();

console.log('Tables in default database:', tables);
// Output: ['posts', 'users', 'comments']

List tables in specific database

Get all tables from the ecommerce database.
const cursor = await r.db('ecommerce').tableList().run(client);

const tables = await cursor.toArray();
console.log('Tables in ecommerce database:', tables);
  • r - Referencing the query builder
  • db - Referencing a database
  • dbList - Listing databases
  • table - Referencing a table
  • tableCreate - Creating a table
  • tableDrop - Dropping a table

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