Details about the ArangoDB Shell
The shell will print its own version number and if successfully connectedto a server the version number of the ArangoDB server.
Use to get a list of command-line options:
unix> ./arangosh --help
STANDARD options:
--audit-log <string> audit log file to save commands and results to
--configuration <string> read configuration file
--help help message
--max-upload-size <uint64> maximum size of import chunks (in bytes) (default: 500000)
--no-auto-complete disable auto completion
--no-colors deactivate color support
--pager <string> output pager (default: "less -X -R -F -L")
--quiet no banner
--temp.path <string> path for temporary files (default: "/tmp/arangodb")
--use-pager use pager
JAVASCRIPT options:
--javascript.check <string> syntax check code JavaScript code from file
--javascript.execute <string> execute JavaScript code from file
--javascript.execute-string <string> execute JavaScript code from string
--javascript.startup-directory <string> startup paths containing the JavaScript files
--javascript.unit-tests <string> do not start as shell, run unit tests instead
--jslint <string> do not start as shell, run jslint instead
--log.level <string> log level (default: "info")
CLIENT options:
--server.connect-timeout <double> connect timeout in seconds (default: 3)
--server.endpoint <string> endpoint to connect to, use 'none' to start without a server (default: "tcp://127.0.0.1:8529")
--server.password <string> password to use when connecting (leave empty for prompt)
--server.request-timeout <double> request timeout in seconds (default: 300)
--server.username <string> username to use when connecting (default: "root")
So while this code may produce similar results when executed in arangosh andarangod, the cpu usage and time required will be really different:
Since the arangosh version will be doing around 100k HTTP requests, and thearangod version will directly write to the database.
#!/usr/bin/arangosh --javascript.execute
require("internal").print("hello world")
db._query("FOR x IN test RETURN x").toArray()
Note that the first line has to end with a blank in order to make it work.Mark it executable to the OS:
and finaly try it out: