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:

    Show execution results

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

    Hide execution results

    Get this view again later by name:

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

    Show execution results

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

    Hide execution results

    1. arangosh> view.properties();

    Show execution results

    Hide execution results

    Set a view property:

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

    Show execution results

    1. {
    2. "cleanupIntervalStep" : 12,
    3. "consolidationIntervalMsec" : 60000,
    4. "consolidationPolicy" : {
    5. "type" : "bytes_accum",
    6. "threshold" : 0.10000000149011612
    7. },
    8. "writebufferActive" : 0,
    9. "writebufferIdle" : 64,
    10. "writebufferSizeMax" : 33554432,
    11. "links" : {
    12. }
    13. }

    Hide execution results

    Add a link:

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

    Show execution results

    1. {
    2. "cleanupIntervalStep" : 12,
    3. "consolidationIntervalMsec" : 60000,
    4. "consolidationPolicy" : {
    5. "type" : "bytes_accum",
    6. "threshold" : 0.10000000149011612
    7. },
    8. "writebufferActive" : 0,
    9. "writebufferIdle" : 64,
    10. "writebufferSizeMax" : 33554432,
    11. "links" : {
    12. "analyzers" : [
    13. "identity"
    14. ],
    15. "fields" : {
    16. },
    17. "includeAllFields" : true,
    18. "storeValues" : "none",
    19. "trackListPositions" : false
    20. }
    21. }
    22. }

    Add another link:

    Show execution results

    1. {
    2. "cleanupIntervalStep" : 12,
    3. "consolidationIntervalMsec" : 60000,
    4. "consolidationPolicy" : {
    5. "type" : "bytes_accum",
    6. "threshold" : 0.10000000149011612
    7. },
    8. "writebufferActive" : 0,
    9. "writebufferIdle" : 64,
    10. "writebufferSizeMax" : 33554432,
    11. "links" : {
    12. "colA" : {
    13. "analyzers" : [
    14. "identity"
    15. ],
    16. "fields" : {
    17. },
    18. "includeAllFields" : true,
    19. "storeValues" : "none",
    20. "trackListPositions" : false
    21. },
    22. "colB" : {
    23. "analyzers" : [
    24. "identity"
    25. "fields" : {
    26. "text" : {
    27. }
    28. },
    29. "includeAllFields" : false,
    30. "storeValues" : "none",
    31. "trackListPositions" : false
    32. }
    33. }
    34. }

    Hide execution results

    Remove the first link again:

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

    Show execution results

    1. {
    2. "cleanupIntervalStep" : 12,
    3. "consolidationIntervalMsec" : 60000,
    4. "consolidationPolicy" : {
    5. "type" : "bytes_accum",
    6. "threshold" : 0.10000000149011612
    7. },
    8. "writebufferActive" : 0,
    9. "writebufferIdle" : 64,
    10. "writebufferSizeMax" : 33554432,
    11. "links" : {
    12. "colB" : {
    13. "analyzers" : [
    14. "identity"
    15. ],
    16. "fields" : {
    17. "text" : {
    18. }
    19. },
    20. "includeAllFields" : false,
    21. "storeValues" : "none",
    22. "trackListPositions" : false
    23. }
    24. }

    Hide execution results

    Drop the view:

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

    Hide execution results