Running V8 Isolates in Multi-Threaded ArangoDB
ArangoDB allows running user-defined JavaScript code in the database. This can be used for more complex, stored procedures-like database operations. Additionally, ArangoDB’s Foxx framework can be used to make any database functionality available via an HTTP REST API. It’s easy to build data-centric microservices with it, using the scripting functionality for tasks like access control, data validation, sanitation etc.
We often get asked how the scripting functionality is implemented under the hood. Additionally, several people have asked how ArangoDB’s JavaScript functionality relates to node.js.
This post tries to explain that in detail.
LoopBack Connector for ArangoDB: Seamless Integration
ArangoDB can be used as a backend data source for APIs that you compose with the popular open-source LoopBack Node.js framework.
In a recent blog article on StrongLoop, Nicholas Duffy explains how to use his new loopback-connector-arango connector to access ArangoDB:
Getting Started with the Node.js LoopBack Connector for ArangoDB
The tutorial uses the loopback-connector-arango which is available as npm
and a demo application which is available from Github. (more…)
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…)
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.
FullStack London
I recently had the chance to visit FullStack London, a well organized conference. Thanks a lot to Skills Matter. FullStack was opened by Douglas Crockford about “The Better Parts” of ES6. I cannot wait to start using them. Douglas was followed by Isaac Schlueter talking about open source in companies. Although this talk was not technical I learned a lot and it was very inspiring.
The remainder of the conference was all about using JavaScript mostly on server-side using Node.js or in robotics. As robotics is not my kind of topic I visited the talks about server-side JS. They confirmed my impression where JS development is heading to: Microservices. (more…)
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
ArangoDB for Node.js Integration | ArangoDB 2012
Note: Our new official nodejs driver is arangojs. You also can look at this blogpost about the new driver.
We got a note from Anders Elo from Sweden. He told us that he has released a ArangoDB client for node.js. Awesome! :-) You can find it on Github under the URL https://github.com/kaerus/arango-client. To install locally
npm install git://github.com/kaerus/arango-client
Anders also writes:
- It's still lacking features and is prone to changes but it works quite nice, atleast I think so. :) I've not documented this project as of yet due to lack of time so I'll briefly instruct you by some examples.*
var arango = require('arango.client'), util = require('util');
/* Prepare a connection, defaults {protocol:'http', hostname:'127.0.0.1', port: 8529} */
db = new arango.Connection({name:"testcollection"});
/* we need to first create our test collection */
db.collection.create(function(err,ret){
console.log("err(%s): ",err, ret);
});
/* create a new document in collection */
db.document.create({a:"test"},function(err,ret){
if(err) console.log("error(%s): ", err,ret);
else console.log(util.inspect(ret));
});
/* create a document and a new collection on demand */
db.document.create(true,"newcollection",{a:"test"},function(err,ret){
if(err) console.log("error(%s): ", err,ret);
else console.log(util.inspect(ret));
});
/* alternate style utilizing events */
db.document.list().on('result',function(result){
console.log(util.inspect(result));
}).on('error',function(error){
console.log("error(%s):", error.code, error.message);
});
The interface to the ArangoDB REST api resides in the lib/api directory. You can find out more details there. Anders also includes some tests, just runt "npm test" to execute them.
Get the latest tutorials,
blog posts and news:
Thanks for subscribing! Please check your email for further instructions.