ArangoJS 6.0.0 released: Load Balancing, Automated Failover and completely written in TypeScript

Version 6.0.0 of the JavaScript driver arangojs is now available (Find it on GitHub).

This is a major release that introduces a small number of breaking changes so make sure to check out the arangojs changelog before upgrading. The most significant additions in this release are support for load balancing and automated failover as well as improved browser and TypeScript support. Read more

More info...

ArangoJS 4 Alpha: Available Now for Testing

The first alpha of the official JavaScript driver arangojs‘ upcoming major release is now available on npm.

Version 4 streamlines the driver’s API by removing unnecessary server roundtrips to obtain references to collections and graphs that already exist:

Before:

var db = require('arangojs')();
db.collection('users')
.then(function(collection) {
 return collection.import(allTheUsers)
})
.then(function() {
 return db.collection('blogs')
})
.then(function(collection) {
 return collection.import(allTheBlogs);
})
.then(function() {
 return db.collection('articles')
})
.then(function(collection) {
 return collection.import(allTheArticles);
})
.then(handleSuccess)
.catch(handleErrors);

After:

var db = require('arangojs')();
db.collection('users').import(allTheUsers)
.then(function() {
 return db.collection('blogs').import(allTheBlogs);
})
.then(function() {
 return db.collection('articles').import(allTheArticles);
})
.then(handleSuccess)
.catch(handleErrors);

(more…)

More info...

ArangoDB JavaScript Driver 3.7: Promises & Performance

ArangoJS, the official ArangoDB JavaScript client, has been updated to version 3.7.0. The new release features significant performance improvements in Node.js and io.js. The dependency on the third-party request module has been replaced with a thin wrapper around node’s own http module, bringing a 3-4x performance improvement for consecutive requests by maintaining a connection pool.

The earlier 3.5 release also added optional support for ES6 promises. While ArangoJS does not provide a promise implementation itself, all asynchronous methods now return promises in JavaScript environments that support them – whether natively (e.g. in io.js or modern browsers) or using a polyfill like es6-promise.

The latest version of ArangoJS is available on NPM and GitHub.

More info...

AQB Update: Write More Readable Queries with ArangoDB

The latest update to the AQL Query Builder for JavaScript addresses a major pain point: the “prefix notation” or LISP style syntax of AQL operator methods. Instead of calling the operator methods on the query builder object itself, you can now directly call them as methods on value objects.

Let’s say you want to write a query that takes all non-admin users with a power level over 9000 and returns their score rounded to the closest 100. In plain AQL this could be written like this:

FOR user IN users
FILTER user.isAdmin == false && user.powerLevel > 9000
RETURN ROUND(user.score / 100) * 100

(more…)

More info...

Exploring More ES6 Features: ArangoDB Insights

ArangoDB 2.5 comes with an upgraded version of V8, Google’s open source JavaScript engine.

The built-in version of V8 has been upgraded from 3.29.54 to 3.31.74.1.

In addition to several already usable ES6 features (detailed in this blog, the following ES6 features are activated in ArangoDB 2.5 by default:

  • iterators and generators
  • template strings
  • enhanced object literals
  • enhanced numeric literals
  • block scoping with let and constant variables using const
  • additional String methods (such as startsWith, repeat etc.)

The above features are available in ArangoDB 2.5, and can now be used for scripting purposes in the ArangoShell and in server-side Foxx actions inside the database.

This blog post briefly explains the features provides some quick examples for using them.

Read more on Jan’s Blog

More info...

Building a self-learning game with ArangoDB, io.js & AngularJS in half a day.

With the ArangoDB Foxx Microservice Framework we’ve introduced an easy way to create a Web API right on top of the NoSQL database.

In early January Max challenged Andreas (AngularJS / NodeJS) that they could build a full-stack application within half a day.

The web application – in short – is a guessing game, in which the computer tries to guess a thing or animal you think of by asking a series of questions, for which you provide the answers. (more…)

More info...

Crawling GitHub with Promises: ArangoDB Tutorial

The new Javascript driver no longer imposes any promises implementation. It follows the standard callback pattern with a callback using err and res.

I wanted to give the new driver a try. A github crawler seemed like a good side-project, especially because the node-github driver follows the same conventions as the Javascript driver.

There are a lot of promise libraries out there. The most popular one – according to NPM – was promises. It should be possible to use any implementation. Therefore I used this one.

(more…)

More info...

ArangoDB Query Builder: Simplifying Database Queries

The most powerful way to query your data in ArangoDB is by using ArangoDB’s own query language, AQL. In the past using AQL in your JavaScript code sadly would often require writing long, unwieldy strings. This made writing complex queries difficult and could often lead to subtle syntax errors or mistakes.

The ArangoDB Query Builder (AQB) is a JavaScript node packaged module that provides a fluid API for writing AQL queries in plain JavaScript. And if you’re using ArangoDB 2.3, the aqb module is already available to your Foxx applications. (more…)

More info...

Handling Binary Data in Foxx: ArangoDB Tutorial

Handling binary data in JavaScript applications is a bit tricky because JavaScript does not provide a data type for binary data. This post explains how to use binary data in JavaScript actions written using ArangoDB’s Foxx.

String vs. binary data

Internally, JavaScript strings are sequences of 16 bit integer values. Furthermore, the ECMAScript standard requires that a JavaScript implementation should interpret characters in conformance with the Unicode standard, using either UCS-2 or UTF-16 encoding.

While this is fine for handling natural language, it becomes problematic when trying to work with arbitrary binary data. Binary data cannot be used safely in a JavaScript string because it may not be valid UTF-16 data.

Read more on Jan’s Blog

If you want to continue with other JavaScript related resources, you should start with ArangoDB NoSQL and JavaScript.

More info...

Cheerio with Node.js and CoffeeScript | ArangoDB Tutorial

Foxx’ main purpose is to create a beautiful API for your AngularJS, EmberJS or Backbone.js front-end. However, sometimes you want to do more. We, for example, needed to parse some HTML files. ArangoDB is capable of using some Node.js modules, but unfortunately Cheerio was not one of those. One problem was that we did not support loading of JSON data modules. So, this was a good excuse to rewrite the module loader in ArangoDB to make it even more Node.js-friendly.

With those improvements, that are currently available in ArangoDB’s devel branch. You can now also “require” a JSON data file. These files must have a filename ending with “.json”. If the filename ends with “.coffee” it is treated as coffee-script file and automatically compiled into JavaScript.

A Foxx app can now contain its own “node_modules” directory to include Node modules which it requires. This makes it much easier to deploy a Foxx app.

More info...

Get the latest tutorials,
blog posts and news: