Options
All
  • Public
  • Public/Protected
  • All
Menu

Class View<PropertiesOptions, Properties>

Represents a View in a Database.

See ArangoSearchView for the concrete type representing an ArangoSearch View.

Type parameters

  • PropertiesOptions: Record<string, any> = any

  • Properties: Record<string, any> = any

Hierarchy

Index

Accessors

isArangoView

  • get isArangoView(): true
  • internal

    Indicates that this object represents an ArangoDB View.

    Returns true

name

  • get name(): string
  • Name of the View.

    Returns string

Methods

create

  • Creates a View with the given options and the instance's name.

    See also Database.createView.

    example
    const db = new Database();
    const view = db.view("potatoes");
    await view.create();
    // the ArangoSearch View "potatoes" now exists
    

    Parameters

    Returns Promise<ViewDescription & Properties>

drop

  • drop(): Promise<boolean>
  • Deletes the View from the database.

    example
    const db = new Database();
    const view = db.view("some-view");
    await view.drop();
    // the View "some-view" no longer exists
    

    Returns Promise<boolean>

exists

  • exists(): Promise<boolean>
  • Checks whether the View exists.

    example
    const db = new Database();
    const view = db.view("some-view");
    const exists = await view.exists();
    console.log(exists); // indicates whether the View exists
    

    Returns Promise<boolean>

get

  • Retrieves general information about the View.

    example
    const db = new Database();
    const view = db.view("some-view");
    const data = await view.get();
    // data contains general information about the View
    

    Returns Promise<ViewDescription & ArangoResponseMetadata>

properties

  • Retrieves the View's properties.

    example
    const db = new Database();
    const view = db.view("some-view");
    const data = await view.properties();
    // data contains the View's properties
    

    Returns Promise<ViewDescription & Properties & ArangoResponseMetadata>

rename

  • Renames the View and updates the instance's name to newName.

    Additionally removes the instance from the Database's internal cache.

    Note: Renaming Views may not be supported when ArangoDB is running in a cluster configuration.

    example
    const db = new Database();
    const view1 = db.view("some-view");
    await view1.rename("other-view");
    const view2 = db.view("some-view");
    const view3 = db.view("other-view");
    // Note all three View instances are different objects but
    // view1 and view3 represent the same ArangoDB view!
    

    Parameters

    • newName: string

      The new name of the View.

    Returns Promise<ViewDescription & ArangoResponseMetadata>

replaceProperties

  • replaceProperties(properties?: PropertiesOptions): Promise<ViewDescription & Properties>
  • Replaces the properties of the View.

    example
    const db = new Database();
    const view = db.view("some-view");
    const result = await view.replaceProperties({
      consolidationIntervalMsec: 234
    });
    console.log(result.consolidationIntervalMsec); // 234
    

    Parameters

    • Optional properties: PropertiesOptions

      New properties of the View.

    Returns Promise<ViewDescription & Properties>

updateProperties

  • updateProperties(properties?: PropertiesOptions): Promise<ViewDescription & Properties>
  • Updates the properties of the View.

    example
    const db = new Database();
    const view = db.view("some-view");
    const result = await view.updateProperties({
      consolidationIntervalMsec: 234
    });
    console.log(result.consolidationIntervalMsec); // 234
    

    Parameters

    • Optional properties: PropertiesOptions

      Properties of the View to update.

    Returns Promise<ViewDescription & Properties>

Generated using TypeDoc