Database Methods



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
[ArangoView 132664, "example" (type arangosearch)]
[ArangoView 132664, "example" (type arangosearch)]
Hide execution results


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.


Get a view by name:

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

Unknown view:

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


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

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

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 .

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

view-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.


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

All Views


Returns all views of the given database.


List all views:

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



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


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


Drop a view:

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