View Methods

Drop

view.drop()

Drops a view and all its data.

Examples

Drop a view:

  1. arangosh> v = db._createView("example", "arangosearch");
  2. ........> // or
  3. arangosh> v = db._view("example");
  4. arangosh> v.drop();
  5. arangosh> db._view("example");

Show execution results

  1. [ArangoView 87589, "example" (type arangosearch)]
  2. [ArangoView 87589, "example" (type arangosearch)]
  3. null

Hide execution results

Query Name

view.name()

Returns the name of the view.

Examples

Get view name:

  1. arangosh> v = db._view("demoView");
  2. arangosh> v.name();

Show execution results

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

Hide execution results

Rename

view.rename(new-name)

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

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

Note: this method is not available in a cluster.

Examples

  1. arangosh> v = db._createView("example", "arangosearch");
  2. arangosh> v.name();
  3. arangosh> v.rename("exampleRenamed");
  4. arangosh> v.name();

Show execution results

  1. [ArangoView 87612, "example" (type arangosearch)]
  2. example
  3. exampleRenamed

Hide execution results

Query Type

view.type()

Returns the type of the view.

Examples

Get view type:

  1. arangosh> v = db._view("demoView");
  2. arangosh> v.type();

Show execution results

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

Hide execution results

Query Properties

view.properties()

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

Examples

Get view properties:

  1. arangosh> v = db._view("demoView");
  2. arangosh> v.properties();

Show execution results

  1. [ArangoView 107, "demoView" (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

Modify Properties

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

Modifies the properties of the view. The format of the result is specific toeach of the supported View Types. partialUpdate is an optionalboolean parameter (true by default) that determines howview-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 propertiescan be found inArangoSearch detailed overview.

Examples

Modify view properties:

  1. arangosh> v = db._view("example");
  2. arangosh> v.properties();
  3. ........> // set cleanupIntervalStep to 12
  4. arangosh> v.properties({cleanupIntervalStep: 12});
  5. ........> // add a link
  6. arangosh> v.properties({links: {demo: {}}})
  7. ........> // remove a link
  8. arangosh> v.properties({links: {demo: null}})

Show execution results

  1. [ArangoView 87596, "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. }
  15. {
  16. "cleanupIntervalStep" : 12,
  17. "consolidationIntervalMsec" : 60000,
  18. "consolidationPolicy" : {
  19. "type" : "bytes_accum",
  20. "threshold" : 0.10000000149011612
  21. },
  22. "writebufferActive" : 0,
  23. "writebufferIdle" : 64,
  24. "writebufferSizeMax" : 33554432,
  25. "links" : {
  26. }
  27. }
  28. {
  29. "cleanupIntervalStep" : 12,
  30. "consolidationIntervalMsec" : 60000,
  31. "consolidationPolicy" : {
  32. "type" : "bytes_accum",
  33. "threshold" : 0.10000000149011612
  34. },
  35. "writebufferActive" : 0,
  36. "writebufferIdle" : 64,
  37. "writebufferSizeMax" : 33554432,
  38. "links" : {
  39. "demo" : {
  40. "analyzers" : [
  41. "identity"
  42. ],
  43. "fields" : {
  44. },
  45. "includeAllFields" : false,
  46. "storeValues" : "none",
  47. "trackListPositions" : false
  48. }
  49. }
  50. }
  51. {
  52. "cleanupIntervalStep" : 12,
  53. "consolidationIntervalMsec" : 60000,
  54. "consolidationPolicy" : {
  55. "type" : "bytes_accum",
  56. "threshold" : 0.10000000149011612
  57. },
  58. "writebufferActive" : 0,
  59. "writebufferIdle" : 64,
  60. "writebufferSizeMax" : 33554432,
  61. "links" : {
  62. }
  63. }

Hide execution results