Syntax

object.without(key1, key2, ..., keyN) → object
object.without([key1, key2, ..., keyN], {optargs}) → object

sequence.without(key1, key2, ..., keyN) → cursor
sequence.without([key1, key2, ..., keyN], {optargs}) → cursor

Arguments

List of field selectors to remove from the documents.
key
string
required
Name of the field(s) to reference. Use dot notation to reference nested fields.

Optargs

Optional arguments to customize the behavior of the function. Provided as an object.
separator
string
default:"."
Separator to use when referencing nested fields

Returns

result
object | Cursor
For single objects, returns an object lacking the specified fields. For sequences, returns a cursor pointing to the projected sequence of documents.

Behavior

  • Removes the specified fields from each document.
  • If a specified field doesn’t exist in a document, it’s ignored.
  • When the primary key (id) is not included in the returned fields, the cursor cannot be iterated over for updates.

Notes & Caveats

  • The original documents are not modified; new documents are returned.

Example

Remove specific fields from a user

Remove the password field from a user document.
const user = await r.table('users').get('user_123').without('password').run(client);

Remove fields from multiple documents

Remove the updated_at and created_at fields from all blog posts.
const posts = await r.table('posts').without('created_at', 'updated_at').run(client);

Remove nested fields

Remove the nested address information from user documents.
const users = await r.table('users').without('address.street').run(client);
  • get - Get a document by primary key
  • getAll - Get multiple documents
  • filter - Filter documents
  • field - Reference a specific field
  • update - Update documents
  • insert - Insert new documents
  • pluck - Pluck fields from documents

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