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:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
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:
1 2 3 4 5 6 7 8 9 10 11 |
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); |