ArangoDB Client for nodejs released

API, nodejs Leave a comment

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_("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.

Dorthe Lübbert

About Dorthe Lübbert

web developer from Cologne, interested in alternative databases & member of the ArangoDB team - mainly helping out with website and community related stuff.

Related posts

  • New Features in ArangoDB 1.2New Features in ArangoDB 1.2
    We have just released beta2 of ArangoDB 1.2. It is available for download here. For everyone interested in trying the new version, here's a quick overview of its major new features & changes: ...
  • API changes in ArangoDB 1.2API changes in ArangoDB 1.2
    Apart from introducing several new features, the upcoming 1.2 version of ArangoDB will change a few of the existing REST API return values. The API changes were necessary to make the ArangoDB's APIs ...
  • The API Implementors GatheringThe API Implementors Gathering
    Dear API Implementors, We want to make it simpler for you to keep up with the development of ArangoDB. We therefore created a dedicated place for all API implementors. If you are implementing a Dri...