AQL Explain Web Interface: ArangoDB Query Optimization

For developers that use the ArangoDB shell arangosh the explain() command and its compact output format is a great resource to check AQL queries. Explain prints the original query, the generated query execution plan, the applied optimizer rules plus the list of indexes that will be used. Jan showed in a blog post how this can look like.

While preparing ArangoDB 2.6 we found some time to add this feature to the Web UI. So now you can check you AQL queries right in the Web-Interface as well. (more…)

More info...

CoffeeScript in ArangoDB: Feature Preview | ArangoDB 2013

In my blog post about npm packages, I tried to use underscore for ArangoDB. I found that the easiest way to archive this, is using the nodes package manager NPM. Node packages and modules follow the Common.JS specification, so they can be used by ArangoDB.

Why not try to use the package coffee-script as well? Install it using

npm install coffee-script

and that’s it. Unfortunately, CoffeeScript use a module “path”, which is not a CommonJS module. I assume that most of the functionality is part or will be part of the module “fs”. The “path.js” from node.js is simple JavaScript code with some references like

'path.exists is now called `fs.exists`'

Being brave, I simply copied the file into my module path and tried again. The next obstacle is node’s global variable “process”. Luckily, this is only used to check for Windows in the module “path”. Also ignoring the module “vm” used to execute JavaScript code, this allows one to actually load CoffeScript into ArangoDB.

arangosh> process = {};
{ }

arangosh> var cs = require("coffee-script");

arangosh> cs.compile("a = 1\nopposite = true\na = -a if opposite", {});
(function() {
  var a, opposite;

  a = 1;

  opposite = true;

  if (opposite) {
    a = -a;
  }

}).call(this);

So, I can now use CoffeeScript definition within ArangoDB. Some of the loaders must be adjusted to check for both “.js” and “.coffee” files. Afterwards it should be possible, to define an action in CoffeeScript as well as JavaScript.

More info...

Using NPM Packages for ArangoDB: Enhance Functionality | 2013

ArangoDB follows the Common.JS specification for modules. However, it would be very convenient, if there was an easy way to install a package like “underscore.js”. These package are, for instance, available using NPM. There is a draft for packages on Common.JS which seems to be compatible with NPM.

NPM has a neat way of dealing with version conflicts. Basically, it allows multiple versions to exists simultaneously. For example, assume you have 4 packages A, B, C, D. A requires B and C and D, B requires C. Then directory layout might be as follows.

node_modules
|
+- A
|  |
|  +- node_modules
|     |
|     +- B
|     |  |
|     |  +- node_modules
|     |     |
|     |     +- C (1.0.0)
|     |
|     +- C (2.0.0)
|
+- D

Package B will see package C in version 1.0.0, while package A sees package C in version 2.0.0.

                                                                                                                                    <!--more-->

This behaviour is easy to implement in ArangoDB. In addition to “Module” there is now a “Package”. Each package has it own module cache. When a package requires a module, the package hierarchy is traversed from the current package to the root (or global) package, until the module is found.

In order to use underscore, switch into the package directory and use NPM to install it

unix> cd /tmp/packages
unix> npm install underscore
npm http GET https://registry.npmjs.org/underscore
npm http 304 https://registry.npmjs.org/underscore
underscore@1.4.4 node_modules/underscore

Now start arangosh with the new “–javascript.package-path” option and enjoy underscore.

unix> arangosh --javascript.package-path /tmp/packages
arangosh> var _ = require("underscore");
arangosh> _.max([1,2,3])
3
More info...

Useful ArangoSH Tips and Tricks | ArangoDB 2012

arangosh, The ArangoDB shell, provides some options that may simplify an ArangoDB user’s life. Some of these options have been added in version 1.1.2, and some options have been around for a while but are probably still less known. It’s time to showcase them.
(more…)

More info...

Get the latest tutorials,
blog posts and news: