ArangoDB Shell Output

The ArangoDB shell will print the output of the last evaluated expressionby default:

  1. arangosh> 42 * 23

Show execution results

  1. 966

Hide execution results

In order to prevent printing the result of the last evaluated expression,the expression result can be captured in a variable, e.g.

  1. arangosh> var calculationResult = 42 * 23

Show execution results

  1.  

Hide execution results

There is also the print function to explicitly print out values in theArangoDB shell:

  1. arangosh> print({ a: "123", b: [1,2,3], c: "test" });

Show execution results

  1. {
  2. "a" : "123",
  3. "b" : [
  4. 1,
  5. 2,
  6. 3
  7. ],
  8. "c" : "test"
  9. }

Hide execution results

By default, the ArangoDB shell uses a pretty printer when JSON documents areprinted. This ensures documents are printed in a human-readable way:

  1. arangosh> db._create("five")
  2. arangosh> for (i = 0; i < 5; i++) db.five.save({value:i})
  3. arangosh> db.five.toArray()

Show execution results

  1. [ArangoCollection 36779, "five" (type document, status loaded)]
  2. [
  3. {
  4. "_key" : "36790",
  5. "_id" : "five/36790",
  6. "_rev" : "_ZHpY5sq--_",
  7. "value" : 2
  8. },
  9. {
  10. "_key" : "36787",
  11. "_id" : "five/36787",
  12. "_rev" : "_ZHpY5sm--B",
  13. "value" : 1
  14. },
  15. {
  16. "_key" : "36796",
  17. "_id" : "five/36796",
  18. "_rev" : "_ZHpY5sq--D",
  19. "value" : 4
  20. },
  21. {
  22. "_key" : "36783",
  23. "_id" : "five/36783",
  24. "_rev" : "_ZHpY5sm--_",
  25. "value" : 0
  26. },
  27. {
  28. "_key" : "36793",
  29. "_id" : "five/36793",
  30. "_rev" : "_ZHpY5sq--B",
  31. "value" : 3
  32. }
  33. ]

Hide execution results

While the pretty-printer produces nice looking results, it will need a lot ofscreen space for each document. Sometimes a more dense output might be better.In this case, the pretty printer can be turned off using the commandstop_pretty_print().

To turn on pretty printing again, use the start_pretty_print() command.