ArangoDB v3.8 reached End of Life (EOL) and is no longer supported.

This documentation is outdated. Please see the most recent version at docs.arangodb.com

Database Methods

View

db._view(view-name)

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

arangosh> view = db._view("example");
........> // or, alternatively
arangosh> view = db["example"]
Show execution results
Hide execution results
[ArangoView 81683, "example" (type arangosearch)]
[ArangoView 81683, "example" (type arangosearch)]

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 should access views using the view name.

Examples

Get a View by name:

arangosh> db._view("demoView");
Show execution results
Hide execution results
[ArangoView 101, "demoView" (type arangosearch)]

Unknown View:

arangosh> db._view("unknown");
Show execution results
Hide execution results
null

Create

db._createView(name, type, properties)

Creates a new View.

name is a string and the name of the View. No View or collection with the same name may already exist in the current database. For more information on valid View names please refer to the naming conventions.

type must be the string "arangosearch", as it is currently the only supported View type.

properties is an optional object containing View configuration specific to each View-type. Currently, only ArangoSearch Views are supported. See ArangoSearch View definition for details.

Examples

arangosh> v = db._createView("example", "arangosearch");
arangosh> v.properties()
arangosh> db._dropView("example")
Show execution results
Hide execution results
[ArangoView 81673, "example" (type arangosearch)]
{ 
  "writebufferIdle" : 64, 
  "writebufferSizeMax" : 33554432, 
  "consolidationPolicy" : { 
    "type" : "tier", 
    "segmentsBytesFloor" : 2097152, 
    "segmentsBytesMax" : 5368709120, 
    "segmentsMax" : 10, 
    "segmentsMin" : 1, 
    "minScore" : 0 
  }, 
  "primarySort" : [ ], 
  "storedValues" : [ ], 
  "writebufferActive" : 0, 
  "consolidationIntervalMsec" : 1000, 
  "cleanupIntervalStep" : 2, 
  "commitIntervalMsec" : 1000, 
  "links" : { 
  }, 
  "primarySortCompression" : "lz4" 
}

All Views

db._views()

Returns all views of the given database.

Examples

List all views:

arangosh> db._views();
Show execution results
Hide execution results
[ 
  [ArangoView 101, "demoView" (type arangosearch)], 
  [ArangoView 81687, "exampleView" (type arangosearch)] 
]

Drop

db._dropView(name)

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

db._dropView(view-identifier)

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

Examples

Drop a view:

arangosh> db._createView("exampleView", "arangosearch");
arangosh> db._dropView("exampleView");
arangosh> db._view("exampleView");
Show execution results
Hide execution results
[ArangoView 81679, "exampleView" (type arangosearch)]
null