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

    1. [ArangoView 88757, "myView" (type arangosearch)]

    Get this view again later by name:

    1. arangosh> view = db._view("myView");

    Show execution results

    Hide execution results

    1. [ArangoView 88757, "myView" (type arangosearch)]
    1. arangosh> view.properties();

    Show execution results

    Hide execution results

    Set a view property:

    1. arangosh> view.properties({cleanupIntervalStep: 12});

    Show execution results

    Hide execution results

    1. {
    2. "cleanupIntervalStep" : 12,
    3. "commitIntervalMsec" : 1000,
    4. "consolidationIntervalMsec" : 10000,
    5. "consolidationPolicy" : {
    6. "type" : "tier",
    7. "segmentsBytesFloor" : 2097152,
    8. "segmentsBytesMax" : 5368709120,
    9. "segmentsMax" : 10,
    10. "segmentsMin" : 1,
    11. "minScore" : 0
    12. },
    13. "primarySort" : [ ],
    14. "writebufferActive" : 0,
    15. "writebufferIdle" : 64,
    16. "writebufferSizeMax" : 33554432,
    17. "links" : {
    18. }
    19. }

    Add a link:

    1. arangosh> view.properties({links: {colA: {includeAllFields: true}}});

    Show execution results

    Hide execution results

    1. {
    2. "cleanupIntervalStep" : 12,
    3. "commitIntervalMsec" : 1000,
    4. "consolidationIntervalMsec" : 10000,
    5. "consolidationPolicy" : {
    6. "type" : "tier",
    7. "segmentsBytesFloor" : 2097152,
    8. "segmentsBytesMax" : 5368709120,
    9. "segmentsMax" : 10,
    10. "segmentsMin" : 1,
    11. "minScore" : 0
    12. },
    13. "primarySort" : [ ],
    14. "writebufferIdle" : 64,
    15. "writebufferSizeMax" : 33554432,
    16. "links" : {
    17. "colA" : {
    18. "analyzers" : [
    19. "identity"
    20. ],
    21. "fields" : {
    22. },
    23. "includeAllFields" : true,
    24. "storeValues" : "none",
    25. "trackListPositions" : false
    26. }
    27. }
    28. }

    Show execution results

    Hide execution results

    1. {
    2. "cleanupIntervalStep" : 12,
    3. "commitIntervalMsec" : 1000,
    4. "consolidationIntervalMsec" : 10000,
    5. "consolidationPolicy" : {
    6. "type" : "tier",
    7. "segmentsBytesFloor" : 2097152,
    8. "segmentsBytesMax" : 5368709120,
    9. "segmentsMax" : 10,
    10. "segmentsMin" : 1,
    11. "minScore" : 0
    12. },
    13. "primarySort" : [ ],
    14. "writebufferActive" : 0,
    15. "writebufferIdle" : 64,
    16. "writebufferSizeMax" : 33554432,
    17. "links" : {
    18. "colA" : {
    19. "analyzers" : [
    20. "identity"
    21. ],
    22. "fields" : {
    23. },
    24. "includeAllFields" : true,
    25. "storeValues" : "none",
    26. "trackListPositions" : false
    27. },
    28. "colB" : {
    29. "identity"
    30. ],
    31. "fields" : {
    32. "text" : {
    33. }
    34. },
    35. "includeAllFields" : false,
    36. "storeValues" : "none",
    37. "trackListPositions" : false
    38. }
    39. }
    40. }

    Remove the first link again:

    1. arangosh> view.properties({links: {colA: null}});

    Show execution results

    Hide execution results

    1. {
    2. "cleanupIntervalStep" : 12,
    3. "commitIntervalMsec" : 1000,
    4. "consolidationIntervalMsec" : 10000,
    5. "consolidationPolicy" : {
    6. "type" : "tier",
    7. "segmentsBytesFloor" : 2097152,
    8. "segmentsBytesMax" : 5368709120,
    9. "segmentsMax" : 10,
    10. "segmentsMin" : 1,
    11. "minScore" : 0
    12. },
    13. "primarySort" : [ ],
    14. "writebufferActive" : 0,
    15. "writebufferIdle" : 64,
    16. "writebufferSizeMax" : 33554432,
    17. "links" : {
    18. "colB" : {
    19. "analyzers" : [
    20. "identity"
    21. ],
    22. "fields" : {
    23. "text" : {
    24. }
    25. },
    26. "includeAllFields" : false,
    27. "storeValues" : "none",
    28. "trackListPositions" : false
    29. }
    30. }

    Drop the view:

    1. arangosh> db._dropView("myView");

    Show execution results

    Hide execution results