View Methods

Drop

view.drop()

Drops a view and all its data.

Examples

Drop a view:

arangosh> v = db._createView("example", "arangosearch");
........> // or
arangosh> v = db._view("example");
arangosh> v.drop();
arangosh> db._view("example");
Show execution results
[ArangoView 132185, "example" (type arangosearch)]
[ArangoView 132185, "example" (type arangosearch)]
null
Hide execution results

Query Name

view.name()

Returns the name of the view.

Examples

Get view name:

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

Rename

view.rename(new-name)

Renames a view using the new-name. The new-name must not already be used by a different view or collection in the same database. new-name must also be a valid view name. For more information on valid view names please refer to the naming conventions.

If renaming fails for any reason, an error is thrown.

Note: this method is not available in a cluster.

Examples

arangosh> v = db._createView("example", "arangosearch");
arangosh> v.name();
arangosh> v.rename("exampleRenamed");
arangosh> v.name();
Show execution results
[ArangoView 132218, "example" (type arangosearch)]
example
exampleRenamed
Hide execution results

Query Type

view.type()

Returns the type of the view.

Examples

Get view type:

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

Query Properties

view.properties()

Returns the properties of the view. The format of the result is specific to each of the supported View Types.

Examples

Get view properties:

arangosh> v = db._view("demoView");
arangosh> v.properties();
Show execution results
[ArangoView 119, "demoView" (type arangosearch)]
{ 
  "writebufferSizeMax" : 33554432, 
  "consolidationPolicy" : { 
    "type" : "bytes_accum", 
    "threshold" : 0.10000000149011612 
  }, 
  "writebufferActive" : 0, 
  "consolidationIntervalMsec" : 60000, 
  "cleanupIntervalStep" : 10, 
  "links" : { 
  }, 
  "writebufferIdle" : 64 
}
Hide execution results

Modify Properties

view.properties(view-property-modification, partialUpdate)

Modifies the properties of the view. The format of the result is specific to each of the supported View Types. partialUpdate is an optional boolean parameter (true by default) that determines how view-property-modification is merged with current view properties (adds or updates view-property-modification properties to current if true and, additionally, removes all other properties if false).

Currently, the only supported view type is arangosearch, and its properties can be found in .

Examples

Modify view properties:

arangosh> v = db._view("example");
arangosh> v.properties();
........> // set cleanupIntervalStep to 12
arangosh> v.properties({cleanupIntervalStep: 12});
........> // add a link
arangosh> v.properties({links: {demo: {}}})
........> // remove a link
arangosh> v.properties({links: {demo: null}})
Show execution results
[ArangoView 132194, "example" (type arangosearch)]
{ 
  "writebufferSizeMax" : 33554432, 
  "consolidationPolicy" : { 
    "type" : "bytes_accum", 
    "threshold" : 0.10000000149011612 
  }, 
  "writebufferActive" : 0, 
  "consolidationIntervalMsec" : 60000, 
  "cleanupIntervalStep" : 10, 
  "links" : { 
  }, 
  "writebufferIdle" : 64 
}
{ 
  "cleanupIntervalStep" : 12, 
  "consolidationIntervalMsec" : 60000, 
  "consolidationPolicy" : { 
    "type" : "bytes_accum", 
    "threshold" : 0.10000000149011612 
  }, 
  "writebufferActive" : 0, 
  "writebufferIdle" : 64, 
  "writebufferSizeMax" : 33554432, 
  "links" : { 
  } 
}
{ 
  "cleanupIntervalStep" : 12, 
  "consolidationIntervalMsec" : 60000, 
  "consolidationPolicy" : { 
    "type" : "bytes_accum", 
    "threshold" : 0.10000000149011612 
  }, 
  "writebufferActive" : 0, 
  "writebufferIdle" : 64, 
  "writebufferSizeMax" : 33554432, 
  "links" : { 
    "demo" : { 
      "analyzers" : [ 
        "identity" 
      ], 
      "fields" : { 
      }, 
      "includeAllFields" : false, 
      "storeValues" : "none", 
      "trackListPositions" : false 
    } 
  } 
}
{ 
  "cleanupIntervalStep" : 12, 
  "consolidationIntervalMsec" : 60000, 
  "consolidationPolicy" : { 
    "type" : "bytes_accum", 
    "threshold" : 0.10000000149011612 
  }, 
  "writebufferActive" : 0, 
  "writebufferIdle" : 64, 
  "writebufferSizeMax" : 33554432, 
  "links" : { 
  } 
}
Hide execution results