Represents a View in a database.Database.

Accessors

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

    Returns string

Methods

  • Deletes the View from the database.

    Returns Promise<boolean>

    Example

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

    Returns Promise<boolean>

    Example

    const db = new Database();
    const view = db.view("some-view");
    const exists = await view.exists();
    console.log(exists); // indicates whether the View exists
  • Retrieves general information about the View.

    Returns Promise<ArangoApiResponse<ViewDescription>>

    Example

    const db = new Database();
    const view = db.view("some-view");
    const data = await view.get();
    // data contains general information about the View
  • Renames the View and updates the instance's name to newName.

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

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

    Parameters

    • newName: string

      The new name of the View.

    Returns Promise<ArangoApiResponse<ViewDescription>>

    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!