ArangoDB Shell Output
The ArangoDB shell will print the output of the last evaluated expression by default:
arangosh> 42 * 23
966
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
There is also the print
function to explicitly print out values in the
ArangoDB shell:
arangosh> print({ a: "123", b: [1,2,3], c: "test" });
{
"a" : "123",
"b" : [
1,
2,
3
],
"c" : "test"
}
arangosh> print({ a: "123", b: [1,2,3], c: "test" });
By default, the ArangoDB shell uses a pretty printer when JSON documents are printed. This ensures documents are printed in a human-readable way:
arangosh> db._create("five")
[ArangoCollection 36885, "five" (type document, status loaded)]
arangosh> for (i = 0; i < 5; i++) db.five.save({value:i})
arangosh> db.five.toArray()
[
{
"_key" : "36899",
"_id" : "five/36899",
"_rev" : "_X0Uvy-G--F",
"value" : 3
},
{
"_key" : "36902",
"_id" : "five/36902",
"_rev" : "_X0Uvy-K--_",
"value" : 4
},
{
"_key" : "36889",
"_id" : "five/36889",
"_rev" : "_X0Uvy-G--_",
"value" : 0
},
{
"_key" : "36893",
"_id" : "five/36893",
"_rev" : "_X0Uvy-G--B",
"value" : 1
},
{
"_key" : "36896",
"_id" : "five/36896",
"_rev" : "_X0Uvy-G--D",
"value" : 2
}
]
arangosh> db._create("five")
arangosh> for (i = 0; i < 5; i++) db.five.save({value:i})
arangosh> db.five.toArray()
While the pretty-printer produces nice looking results, it will need a lot of screen space for each document. Sometimes a more dense output might be better. In this case, the pretty printer can be turned off using the command stop_pretty_print().
To turn on pretty printing again, use the start_pretty_print() command.