Skip to content
This repository

This is a node.js driver for OrientDB.

Readme.md

Introduction

This is a node.js driver for OrientDB using the OrientDB binary protocol.

Installation

npm install orientdb

As developer you should fork/clone this repo and once you have it on your machine, do the following in your repo directory:

npm install

Versioning

In order to make it clearer what OrientDB version is supported we will the following versionning scheme: x.y.z, where x.y is the the OrientDB major and minor version.

For example:

  • when OrientDB releases version 1.3.0 we will start publishing versions 1.3.z
  • when OrientDB version 1.4.0 is out, we will start publishing 1.4.z versions

The z part of our version is our internal patch number for that OrientDB release. This will be used using the semantic versioning (semver) rules.

For example:

  • before an OrientDB release (say 1.5.0), we will use versions like 1.5.0-alpha1 or 1.5.0-beta1
  • by the time OrientDB releases version 1.5.1, we are probably further with the patch number z (say 1.5.3) due to bug correction, forgotten features, etc. To test OrientDB 1.5.1 we will start using versions like: 1.5.4-beta1, where our 1.5.4 version will correspond to the OrientDB release 1.5.1.

Is this clear? ;)

Tutorial

To start using OrientDB and nodejs, check out the "Blog Tutorial".

Status

This OrientDB driver is almost mature now, but we are still testing it. While we use it in production already and therefore it implements a sufficient number of features for making a fully featured application, we recommend you make some thorough tests before you do it as well. If you find any problems, let us know such that we can improve things. Until version 1.0 we also don't guarantee any backwards compatibility and API stability since we are trying things out. But 1.0 should not be far from now.

The following commands are not implemented yet (just pick one and send us a pull request):

  • RECORD_CHANGE_IDENTITY
  • RECORD_CLEAN_OUT
  • POSITIONS_FLOOR
  • POSITIONS_CEILING
  • PUSH_RECORD
  • PUSH_DISTRIB_CONFIG
  • DB_COPY
  • REPLICATION
  • CLUSTER

For a more complete list, check out the Driver Compatibility Matrix

Supported database versions

We test each release against the following OrientDB versions: 1.1.0, 1.3.0.

We've had to drop OrientDB 1.2.0 support because of this issue. If you're using 1.2.0, we strongly encourage you to evaluate 1.3.0.

Testing

An OrientDB Graph Edition server instance must be running. Use the test configuration files to provide data to the tests about the running instance (user, port, etc.).

Then run:

npm test

to run all the tests under test, or

node test/db_open_close.js

to run a specific test.

And make sure all run before you make a pull request.

NOTE: The test/z_shutdown.js will shutdown the server. So make sure it's the last one to run. (i.e. Don't add a test that is after this one in Lexicographical order.)

Connecting to a database

var orient = require("orientdb"),
    Db = orient.Db,
    Server = orient.Server;

var dbConfig = {
    user_name: "admin",
    user_password: "admin"
};
var serverConfig = {
    host: "localhost",
    port: 2424
};

var server = new Server(serverConfig);
var db = new Db("temp", server, dbConfig);

db.open(function(err) {

    if (err) {
        console.log(err);
        return;
    }

    console.log("Database '" + db.databaseName + "' has " + db.clusters.length + " clusters");

    // use db.command(...) function to run OrientDB SQL queries
});

Changes

See ChangeLog

Driver Compatibility Matrix

The following table list all the commands exposed by OrientDB. It's here to help you helping us: just pick one of the not yet implemented commands and send us a pull request.

Each command has a JS API if it's already supported, or a "not yet implemented" if not.

It also has a Yes/No/Not yet label under each supported OrientDB versions: commands may be implemented but may be available only with recent OrientDB.

Command JS API OrientDB 1.1.0 OrientDB 1.3.0 OrientDB 1.4.0
SHUTDOWN Server.shutdown Yes Yes Yes
CONNECT Server.connect Yes Yes Yes
DB_OPEN Db.open Yes Yes Yes
DB_CREATE Db.create Yes Yes Yes
DB_CLOSE Db.close Yes Yes Yes
DB_EXIST Db.exist Yes Yes Yes
DB_DROP Db.drop Yes Yes Yes
DB_SIZE Db.size Yes Yes Yes
DB_COUNTRECORDS Db.countRecords Yes Yes Yes
DATACLUSTER_ADD Db.addDataCluster Yes Yes Yes
DATACLUSTER_DROP Db.dropDataCluster Yes Yes Yes
DATACLUSTER_COUNT Db.countDataClusters Yes Yes Yes
DATACLUSTER_DATARANGE Db.rangeDataClusters Yes Yes Yes
DATACLUSTER_LH_CLUSTER_IS_USED Db.isLHClustersUsed No Yes Yes
DATASEGMENT_ADD Db.addDataSegment Yes Yes Yes
DATASEGMENT_DROP Db.dropDataSegment Yes Yes Yes
RECORD_LOAD Db.loadRecord Yes Yes Yes
RECORD_CREATE Db.createRecord Yes Yes Yes
RECORD_UPDATE Db.updateRecord Yes Yes Yes
RECORD_DELETE Db.deleteRecord Yes Yes Yes
RECORD_CHANGE_IDENTITY Not yet implemented No Not yet Not yet
POSITIONS_HIGHER Work in progress No Yes Not yet
POSITIONS_LOWER Work in progress No Yes Not yet
RECORD_CLEAN_OUT Not yet implemented No Not yet Not yet
POSITIONS_FLOOR Not yet implemented No Not yet Not yet
POSITIONS_CEILING Not yet implemented No Not yet Not yet
COUNT Db.countRecords Yes Yes Yes
COMMAND Db.command Yes Yes Yes
TX_COMMIT Db.commit Yes Yes Yes
CONFIG_GET Server.configGet Yes Yes Yes
CONFIG_SET Server.configSet Yes Yes Yes
CONFIG_LIST Server.configList Yes No Yes
DB_RELOAD Db.reload Yes Yes Yes
DB_LIST Server.listDatabases Yes Yes Yes
PUSH_RECORD Not yet implemented Yes Yes Yes
PUSH_DISTRIB_CONFIG Not yet implemented Yes Yes Yes
DB_COPY Not yet implemented Yes Yes Yes
REPLICATION Not yet implemented Yes Yes Yes
CLUSTER Not yet implemented Yes Yes Yes
DB_FREEZE Work in Progress Yes Yes Yes
DB_RELEASE Work in Progress Yes Yes Yes
Something went wrong with that request. Please try again.