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

Hide execution results

  1. [ArangoView 80999, "example" (type arangosearch)]
  2. [ArangoView 80999, "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:

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

Show execution results

Hide execution results

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

Unknown View:

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

Show execution results

Hide execution results

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

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

Show execution results

Hide execution results

  1. [ArangoView 80989, "example" (type arangosearch)]
  2. {
  3. "writebufferIdle" : 64,
  4. "writebufferSizeMax" : 33554432,
  5. "consolidationPolicy" : {
  6. "type" : "tier",
  7. "segmentsBytesFloor" : 2097152,
  8. "segmentsBytesMax" : 5368709120,
  9. "segmentsMax" : 10,
  10. "segmentsMin" : 1,
  11. "minScore" : 0
  12. },
  13. "primarySort" : [ ],
  14. "storedValues" : [ ],
  15. "writebufferActive" : 0,
  16. "consolidationIntervalMsec" : 1000,
  17. "cleanupIntervalStep" : 2,
  18. "commitIntervalMsec" : 1000,
  19. "links" : {
  20. },
  21. "primarySortCompression" : "lz4"
  22. }

All Views

db._views()

Returns all views of the given database.

Examples

List all views:

  1. arangosh> db._views();

Show execution results

Hide execution results

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

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:

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

Show execution results

Hide execution results

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