Syntax

r.expr(value) → expression

Arguments

List of arguments to provide.
value
any
required
The value to convert into a RuloDB expression. Can be a primitive value, object, array, or function.

Optargs

No optional arguments.

Returns

expression
Expression
Returns a RuloDB expression that can be used in queries, operations, and transformations.

Behavior

  • Allows you to perform operations on literal values within queries.
  • Enables complex computations and transformations within database operations.
  • Expressions are evaluated on the database server, reducing overhead on the client.

Notes & Caveats

  • Expressions are particularly useful for server-side computations.
  • Expressions can be chained with other RuloDB operations.

Example

Basic value expressions

Convert values to RuloDB expressions.
// Convert a number
const numberExpr = r.expr(42);

// Convert a string
const stringExpr = r.expr('Hello, World!');

// Convert an object
const objectExpr = r.expr({
  name: 'Alice',
  age: 30,
  active: true
});

// Convert an array
const arrayExpr = r.expr([1, 2, 3, 4, 5]);
  • r - Referencing the query builder
  • filter - Filtering with expressions

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