Database Methods

View

db._view(view-name)

Returns the view with the given name or null if no such view exists.

  1. arangosh> view = db._view("example");
  2. ........> // or, alternatively
  3. arangosh> view = db["example"]

Show execution results

  1. [ArangoView 87577, "example" (type arangosearch)]
  2. [ArangoView 87577, "example" (type arangosearch)]

Hide execution results

db._view(view-identifier)

Returns the view with the given identifier or null if no such view exists.Accessing views by identifier is discouraged for end users. End users shouldaccess views using the view name.

Examples

Get a view by name:

  1. arangosh> db._view("demoView");

Show execution results

  1. [ArangoView 107, "demoView" (type arangosearch)]

Hide execution results

Unknown view:

  1. arangosh> db._view("unknown");

Show execution results

  1. null

Hide execution results

Create

db._createView(view-name, view-type, view-properties)

Creates a new view named view-name of type view-type with propertiesview-properties.

view-name is a string and the name of the view. No view or collection with thesame name may already exist in the current database. For more information onvalid view names please refer to thenaming conventions.

view-type must be the string "arangosearch", as it is currently the onlysupported view type.

view-properties is an optional object containing view configuration specificto each view-type. Currently, only ArangoSearch Views are supported. SeeArangoSearch View definitionfor details.

Examples

  1. arangosh> v = db._createView("example", "arangosearch");
  2. arangosh> v.properties()
  3. arangosh> db._dropView("example")

Show execution results

  1. [ArangoView 87567, "example" (type arangosearch)]
  2. {
  3. "writebufferSizeMax" : 33554432,
  4. "consolidationPolicy" : {
  5. "type" : "bytes_accum",
  6. "threshold" : 0.10000000149011612
  7. },
  8. "writebufferActive" : 0,
  9. "consolidationIntervalMsec" : 60000,
  10. "cleanupIntervalStep" : 10,
  11. "links" : {
  12. },
  13. "writebufferIdle" : 64
  14. }

Hide execution results

All Views

db._views()

Returns all views of the given database.

Examples

List all views:

  1. arangosh> db._views();

Show execution results

  1. [
  2. [ArangoView 107, "demoView" (type arangosearch)],
  3. [ArangoView 87581, "exampleView" (type arangosearch)]
  4. ]

Hide execution results

Drop

db._dropView(view-name)

Drops a view named view-name and all its data. No error is thrown if there isno such view.

db._dropView(view-identifier)

Drops a view identified by view-identifier with all its data. No error isthrown if there is no such view.

Examples

Drop a view:

  1. arangosh> db._createView("exampleView", "arangosearch");
  2. arangosh> db._dropView("exampleView");
  3. arangosh> db._view("exampleView");

Show execution results

  1. [ArangoView 87573, "exampleView" (type arangosearch)]
  2. null

Hide execution results