JavaScript Interface for Views

    Like collections, views are accessed by the user via their unique name and internally via their identifier. Using the identifier for accessing views is discouraged. Views share their namespace with collections, so there cannot exist a view and a collection with the same name in the same database.

    Usage

    Here follow some basic usage examples. More details can be found in the following chapters:

    Create a view with default properties:

    Show execution results

    Hide execution results

    Get this view again later by name:

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

    Show execution results

    Hide execution results

    1. [ArangoView 81054, "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" : 1000,
    5. "consolidationPolicy" : {
    6. "type" : "tier",
    7. "segmentsBytesFloor" : 2097152,
    8. "segmentsBytesMax" : 5368709120,
    9. "segmentsMax" : 10,
    10. "segmentsMin" : 1,
    11. "minScore" : 0
    12. },
    13. "primarySort" : [ ],
    14. "primarySortCompression" : "lz4",
    15. "storedValues" : [ ],
    16. "writebufferActive" : 0,
    17. "writebufferIdle" : 64,
    18. "writebufferSizeMax" : 33554432,
    19. "links" : {
    20. }
    21. }

    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" : 1000,
    5. "consolidationPolicy" : {
    6. "type" : "tier",
    7. "segmentsBytesFloor" : 2097152,
    8. "segmentsBytesMax" : 5368709120,
    9. "segmentsMax" : 10,
    10. "segmentsMin" : 1,
    11. "minScore" : 0
    12. },
    13. "primarySort" : [ ],
    14. "primarySortCompression" : "lz4",
    15. "writebufferActive" : 0,
    16. "writebufferIdle" : 64,
    17. "writebufferSizeMax" : 33554432,
    18. "colA" : {
    19. "analyzers" : [
    20. "identity"
    21. ],
    22. "fields" : {
    23. },
    24. "includeAllFields" : true,
    25. "storeValues" : "none",
    26. "trackListPositions" : false
    27. }
    28. }
    29. }

    Show execution results

    Hide execution results

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

    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" : 1000,
    5. "consolidationPolicy" : {
    6. "type" : "tier",
    7. "segmentsBytesFloor" : 2097152,
    8. "segmentsBytesMax" : 5368709120,
    9. "segmentsMax" : 10,
    10. "segmentsMin" : 1,
    11. "minScore" : 0
    12. },
    13. "primarySort" : [ ],
    14. "primarySortCompression" : "lz4",
    15. "storedValues" : [ ],
    16. "writebufferActive" : 0,
    17. "writebufferIdle" : 64,
    18. "writebufferSizeMax" : 33554432,
    19. "links" : {
    20. "colB" : {
    21. "analyzers" : [
    22. "identity"
    23. ],
    24. "fields" : {
    25. "text" : {
    26. }
    27. },
    28. "includeAllFields" : false,
    29. "storeValues" : "none",
    30. "trackListPositions" : false
    31. }
    32. }
    33. }

    Drop the view:

      Show execution results

      Hide execution results