Syntax

client.disconnect() → void

Arguments

No arguments.

Optargs

No optional arguments.

Returns

No return value.

Behavior

  • Closes the connection to the RuloDB server.
  • Releases all resources associated with the client connection.
  • Should be called when the client is no longer needed to free up resources.

Notes & Caveats

  • Once disconnected, the client cannot be used for further operations until reconnected.
  • Any ongoing queries will be cancelled when the connection is closed.

Example

Basic disconnect

Close the connection after completing database operations.
import { Client, r } from '@rulodb/rulodb';
const client = new Client();

await client.connect();
await r.dbCreate('myDb').run(client);
await client.disconnect();

Disconnect in error handling

Ensure proper cleanup even when operations fail.
const client = new Client();

try {
  await client.connect();
  await r.table('users').run(client);
} finally {
  await client.disconnect();
}
  • connect - Connecting to RuloDB
  • r - Referencing the query builder

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