JavaScript Interface to Views
Like collections, views are accessed by the user viatheir unique name and internally via their identifier. Using the identifier foraccessing views is discouraged. Views share their namespace with collections,so there cannot exist a view and a collection with the same name in the samedatabase.
Usage
Here follow some basic usage examples. More details can be found in thefollowing chapters:
- ArangoSearch Views
- View MethodsCreate a view with default properties:
Show execution results
- [ArangoView 87629, "myView" (type arangosearch)]
Hide execution results
Get this view again later by name:
- arangosh> view = db._view("myView");
Show execution results
- [ArangoView 87629, "myView" (type arangosearch)]
Hide execution results
- arangosh> view.properties();
Show execution results
Hide execution results
Set a view property:
- arangosh> view.properties({cleanupIntervalStep: 12});
Show execution results
- {
- "cleanupIntervalStep" : 12,
- "consolidationIntervalMsec" : 60000,
- "consolidationPolicy" : {
- "type" : "bytes_accum",
- "threshold" : 0.10000000149011612
- },
- "writebufferActive" : 0,
- "writebufferIdle" : 64,
- "writebufferSizeMax" : 33554432,
- "links" : {
- }
- }
Hide execution results
Add a link:
- arangosh> view.properties({links: {colA: {includeAllFields: true}}});
Show execution results
- {
- "cleanupIntervalStep" : 12,
- "consolidationIntervalMsec" : 60000,
- "consolidationPolicy" : {
- "type" : "bytes_accum",
- "threshold" : 0.10000000149011612
- },
- "writebufferActive" : 0,
- "writebufferIdle" : 64,
- "writebufferSizeMax" : 33554432,
- "links" : {
- "analyzers" : [
- "identity"
- ],
- "fields" : {
- },
- "includeAllFields" : true,
- "storeValues" : "none",
- "trackListPositions" : false
- }
- }
- }
Add another link:
Show execution results
- {
- "cleanupIntervalStep" : 12,
- "consolidationIntervalMsec" : 60000,
- "consolidationPolicy" : {
- "type" : "bytes_accum",
- "threshold" : 0.10000000149011612
- },
- "writebufferActive" : 0,
- "writebufferIdle" : 64,
- "writebufferSizeMax" : 33554432,
- "links" : {
- "colA" : {
- "analyzers" : [
- "identity"
- ],
- "fields" : {
- },
- "includeAllFields" : true,
- "storeValues" : "none",
- "trackListPositions" : false
- },
- "colB" : {
- "analyzers" : [
- "identity"
- "fields" : {
- "text" : {
- }
- },
- "includeAllFields" : false,
- "storeValues" : "none",
- "trackListPositions" : false
- }
- }
- }
Hide execution results
Remove the first link again:
- arangosh> view.properties({links: {colA: null}});
Show execution results
- {
- "cleanupIntervalStep" : 12,
- "consolidationIntervalMsec" : 60000,
- "consolidationPolicy" : {
- "type" : "bytes_accum",
- "threshold" : 0.10000000149011612
- },
- "writebufferActive" : 0,
- "writebufferIdle" : 64,
- "writebufferSizeMax" : 33554432,
- "links" : {
- "colB" : {
- "analyzers" : [
- "identity"
- ],
- "fields" : {
- "text" : {
- }
- },
- "includeAllFields" : false,
- "storeValues" : "none",
- "trackListPositions" : false
- }
- }
Hide execution results
Drop the view:
- arangosh> db._dropView("myView");
Hide execution results