ArangoDB Shell Output
The ArangoDB shell will print the output of the last evaluated expressionby default:
- arangosh> 42 * 23
Show execution results
- 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.
- arangosh> var calculationResult = 42 * 23
Show execution results
Hide execution results
There is also the print
function to explicitly print out values in theArangoDB shell:
- arangosh> print({ a: "123", b: [1,2,3], c: "test" });
Show execution results
- {
- "a" : "123",
- "b" : [
- 1,
- 2,
- 3
- ],
- "c" : "test"
- }
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:
- arangosh> db._create("five")
- arangosh> for (i = 0; i < 5; i++) db.five.save({value:i})
- arangosh> db.five.toArray()
Show execution results
- [ArangoCollection 36779, "five" (type document, status loaded)]
- [
- {
- "_key" : "36790",
- "_id" : "five/36790",
- "_rev" : "_ZHpY5sq--_",
- "value" : 2
- },
- {
- "_key" : "36787",
- "_id" : "five/36787",
- "_rev" : "_ZHpY5sm--B",
- "value" : 1
- },
- {
- "_key" : "36796",
- "_id" : "five/36796",
- "_rev" : "_ZHpY5sq--D",
- "value" : 4
- },
- {
- "_key" : "36783",
- "_id" : "five/36783",
- "_rev" : "_ZHpY5sm--_",
- "value" : 0
- },
- {
- "_key" : "36793",
- "_id" : "five/36793",
- "_rev" : "_ZHpY5sq--B",
- "value" : 3
- }
- ]
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.