0

Dear arangodb community,

How mature is arangojs? When I tried "Tutorial: Node.js (io.js) in 10 minutes", the exercises 1 thru 4 work as expected. But the 5 thru 10 failed. From the following exercise, I am getting

  Database created: undefined

     instead of 

  Database created: "mydb"

Thus the remaining exercises cannot continue, since the crucial object-bearing variable (mydb) is null. But, observing that "mydb" data base is correctly created in arangodb, my question is just related to the maturity of aragogojs (arangodb's Javascript driver). Or how do I fix it?

db.createDatabase('mydb', function(err, newdb) {
  if (err) {
    console.log('Failed to create database: %j',
      err.message);
  } else {
    console.log('Database created: %j', newdb.name);
    mydb = newdb;
  }
 });

Thanks

2 Answers 2

2

The announced, updated node tutorial using the 4.x version of arangojs is available now.

Creating a new database changed to:

db.createDatabase('mydb').then(
  () => console.log('Database created'),
  err => console.error('Failed to create database:', err)
);

All asynchronous methods in the ArangoDB driver return promises but you can also pass a node-style callback instead:

db.createDatabase('mydb', function (err) {
  if (!err) console.log('Database created');
  else console.error('Failed to create database:', err);
});
Sign up to request clarification or add additional context in comments.

Comments

1

The Node tutorial is based on version 3.x of the arangojs driver. The driver has recently been updated to version 4.x, which contains a number of breaking API changes.

The tutorial will soon be updated to reflect these changes. In the meantime you can follow the tutorial by installing version 3 explicitly:

npm install arangojs@3

2 Comments

Alan, Thanks. arangogjs@3 is causing EPEERINVALID, which will require minor jiggering. I am looking forward to seeing the tutorial update. Since arangodb looks really good on paper, I'd like to confirm its maturity and production readiness. Please keep us posted. Regards
@JohMethod that sounds like a problem with some other package having a conflict in its peer dependencies (arangojs doesn't have any of its own). As far as I understand peer dependencies the error shouldn't cause any problems in using arangojs itself. Similar problem: github.com/npm/npm/issues/4749

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.