GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Close
  • FAQ
  • Docs
  • API
  • Community
  • Blog
  • Accessing ReQL
  • r
  • connect
  • close
  • reconnect
  • use
  • run
  • changes

This view

  • Original page
  • New address

GeezerVison is showing rethinkdb.com — ReQL command reference - RethinkDB


▲ Back to top

Command syntax

bool.or([bool, bool, ...]) → bool

r.or([bool, bool, ...]) → bool

Description

Compute the logical “or” of one or more values.

The or command can be used as an infix operator after its first argument (r.expr(true).or(false)) or given all of its arguments as parameters (r.or(true,false)).

Calling or with zero arguments will return false.

Example: Return whether either a or b evaluate to true.

var a = true, b = false;
r.expr(a).or(b).run(conn, callback);
// result passed to callback
true

Example: Return whether any of x, y or z evaluate to true.

var x = false, y = false, z = false;
r.or(x, y, z).run(conn, callback);
// result passed to callback
false

Note: When using or inside a filter predicate to test the values of fields that may not exist on the documents being tested, you should use the default command with those fields so they explicitly return false.

r.table('posts').filter(
    r.row('category').default('foo').eq('article').
    or(r.row('genre').default('foo').eq('mystery'))
).run(conn, callback);

Related commands

  • and
  • eq
  • ne

Get more help

Couldn't find what you were looking for?

  • Ask a question on Stack Overflow
  • Chat with us and our community on Slack
  • Talk to the team on IRC on #[email protected] — via Webchat
  • Ping @rethinkdb on Twitter
  • Post an issue on the documentation issue tracker on GitHub

Contribute: edit this page or open an issue

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.