Syntax

value.and(otherValue) → result

Arguments

List of arguments to provide.
otherValue
boolean
required
The value to compare with.

Optargs

No optional arguments.

Returns

result
boolean
Returns true if both values are true and false otherwise.

Behavior

  • Performs logical AND operation on two boolean values.
  • Returns true only when both the original value and otherValue are true.
  • Can be chained with other logical operators for complex conditions.

Notes & Caveats

  • Both values are evaluated as booleans using RuloDB’s truthiness rules.
  • The operation is short-circuited: if the first value is false, the second is not evaluated.

Example

Filter users by age and country

Filter for users who are adults and from the USA.
await r
  .table('users')
  .filter((doc) => doc.age.ge(21).and(doc.country.eq('USA')))
  .run(client);

Multiple conditions

Chain multiple AND conditions together.
await r
  .table('orders')
  .filter((doc) =>
    doc.status.eq('shipped').and(doc.value.gt(100)).and(doc.field('customer.verified').eq(true))
  )
  .run(client);
  • eq - Logical Equality Operation
  • ne - Logical Inequality Operation
  • lt - Logical Less Than Operation
  • le - Logical Less Than or Equal Operation
  • gt - Logical Greater Than Operation
  • ge - Logical Greater Than or Equal Operation
  • or - Logical OR Operation
  • not - Logical NOT Operation
  • field - Referencing a Field
  • filter - Filtering Documents

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