Syntax

r.db(name) → database

Arguments

List of arguments to provide.
name
string
default:"default"
Name of the database to select. Must be a valid database name. If not defined, the default database is selected.

Optargs

No optional arguments.

Returns

database
object
The query builder object for database operations.

Behavior

  • In contrast to the table function, this function does not return all tables in the database if called as r.db('myDb').run(client).

Notes & Caveats

No notes.

Example

Filter orders from the UAE in the default database

Filter for orders in the orders table where the order’s shipping address country is UAE, where the country is a nested field of address.
await r
  .db()
  .table('orders')
  .filter((doc) => doc.field('address.country').eq('UAE'))
  .run(client);

Select payments from the finance database

Filter for payments in the payments table where the amount is greater than or equal to 100.
await r
  .db('finance')
  .table('payments')
  .filter((doc) => doc.field('amount').ge(100))
  .run(client);
  • r - Referencing the query builder
  • connect - Connecting to RuloDB
  • disconnect - Disconnecting from RuloDB
  • dbCreate - Creating a database
  • dbDrop - Dropping a database
  • dbList - Listing databases

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