JavaScript Interface for Views
Like , 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:
Create a view with default properties:
Show execution results
Hide execution results
- [ArangoView 88757, "myView" (type arangosearch)]
Get this view again later by name:
- arangosh> view = db._view("myView");
Show execution results
Hide execution results
- [ArangoView 88757, "myView" (type arangosearch)]
- arangosh> view.properties();
Show execution results
Hide execution results
Set a view property:
- arangosh> view.properties({cleanupIntervalStep: 12});
Show execution results
Hide execution results
- {
- "cleanupIntervalStep" : 12,
- "commitIntervalMsec" : 1000,
- "consolidationIntervalMsec" : 10000,
- "consolidationPolicy" : {
- "type" : "tier",
- "segmentsBytesFloor" : 2097152,
- "segmentsBytesMax" : 5368709120,
- "segmentsMax" : 10,
- "segmentsMin" : 1,
- "minScore" : 0
- },
- "primarySort" : [ ],
- "writebufferActive" : 0,
- "writebufferIdle" : 64,
- "writebufferSizeMax" : 33554432,
- "links" : {
- }
- }
Add a link:
- arangosh> view.properties({links: {colA: {includeAllFields: true}}});
Show execution results
Hide execution results
- {
- "cleanupIntervalStep" : 12,
- "commitIntervalMsec" : 1000,
- "consolidationIntervalMsec" : 10000,
- "consolidationPolicy" : {
- "type" : "tier",
- "segmentsBytesFloor" : 2097152,
- "segmentsBytesMax" : 5368709120,
- "segmentsMax" : 10,
- "segmentsMin" : 1,
- "minScore" : 0
- },
- "primarySort" : [ ],
- "writebufferIdle" : 64,
- "writebufferSizeMax" : 33554432,
- "links" : {
- "colA" : {
- "analyzers" : [
- "identity"
- ],
- "fields" : {
- },
- "includeAllFields" : true,
- "storeValues" : "none",
- "trackListPositions" : false
- }
- }
- }
Show execution results
Hide execution results
- {
- "cleanupIntervalStep" : 12,
- "commitIntervalMsec" : 1000,
- "consolidationIntervalMsec" : 10000,
- "consolidationPolicy" : {
- "type" : "tier",
- "segmentsBytesFloor" : 2097152,
- "segmentsBytesMax" : 5368709120,
- "segmentsMax" : 10,
- "segmentsMin" : 1,
- "minScore" : 0
- },
- "primarySort" : [ ],
- "writebufferActive" : 0,
- "writebufferIdle" : 64,
- "writebufferSizeMax" : 33554432,
- "links" : {
- "colA" : {
- "analyzers" : [
- "identity"
- ],
- "fields" : {
- },
- "includeAllFields" : true,
- "storeValues" : "none",
- "trackListPositions" : false
- },
- "colB" : {
- "identity"
- ],
- "fields" : {
- "text" : {
- }
- },
- "includeAllFields" : false,
- "storeValues" : "none",
- "trackListPositions" : false
- }
- }
- }
Remove the first link again:
- arangosh> view.properties({links: {colA: null}});
Show execution results
Hide execution results
- {
- "cleanupIntervalStep" : 12,
- "commitIntervalMsec" : 1000,
- "consolidationIntervalMsec" : 10000,
- "consolidationPolicy" : {
- "type" : "tier",
- "segmentsBytesFloor" : 2097152,
- "segmentsBytesMax" : 5368709120,
- "segmentsMax" : 10,
- "segmentsMin" : 1,
- "minScore" : 0
- },
- "primarySort" : [ ],
- "writebufferActive" : 0,
- "writebufferIdle" : 64,
- "writebufferSizeMax" : 33554432,
- "links" : {
- "colB" : {
- "analyzers" : [
- "identity"
- ],
- "fields" : {
- "text" : {
- }
- },
- "includeAllFields" : false,
- "storeValues" : "none",
- "trackListPositions" : false
- }
- }
Drop the view:
- arangosh> db._dropView("myView");
Show execution results
Hide execution results