Official orientdb driver for node.js. Fast, lightweight, uses the binary protocol.
NOTE: Release v3.0 provides new APIs in order to support OrientDB 3.0 features.
- Tested with latest OrientDB (2.2.x and 3.0.x).
- Intuitive API, based on bluebird promises.
- Fast binary protocol parser.
- Streaming Support
- Stateful Transaction Support
- Distributed Support
- Access multiple databases via the same socket (Session Pooling).
- Connection Pooling
- Migration support.
- Simple CLI.
Versions and Compatibility
OrientJS v3.0 contains backwards compatible APIs for OrientDB 2.2.x and OrientDB 3.0.x using the old protocol version 33 (Legacy). New APIs are shipped in v3.0 to support the new protocol featuring Streaming, Stateful transactions, new SQL engine etc..
Install via npm.
npm install orientjs
For Typescript usage :
npm install @types/orientjs
Connect to OrientDB
connect function in order to create a new
const OrientDBClient = OrientDBClient;OrientDBClient;
To open a new standalone session use the
client.session api. This api will create a new stateful session associated with the given database and credentials. Once done, call
session.close in order to release the session on the server. Session are stateful since OrientJS 3.0 as they can execute server side transactions.
Opening and closing sessions everytime can be expensive, since open and close require a network request to the server. Use the API
client.sessions to create a pool of sessions with a given database and credentials. To get a session from the pool call the api
pool.acquire. Once done with the session you can return the session to the pool by calling
// Create a sessions Poolclient;});
Once obtained a session using the above APIs you can:
- Run a Query (Idempotent SQL statement)
- Run a Command (Idempotent or non idempotent SQL statement)
- Run a Transaction
- Run a live query
.all API that convert the stream to a Promise and collect the result set into an array
Use the api session.runInTransaction in order to run a unit of work in a managed transaction (begin/commit/retry)
To run the test suite, first invoke the following command within the repo, installing the development dependencies:
Then run the tests:
Later in 2014, codemix refactored the library to make it easier to extend and maintain, and introduced an API similar to nano. The result is so different from the original codebase that it warranted its own name and npm package. This also gave us the opportunity to switch to semantic versioning.
In June 2015, Orient Technologies company officially adopted the Oriento driver and renamed it as OrientJS.
Notes for contributors
Please see CONTRIBUTING.
Building from the Source Code
When building from source code, you need to download the driver directly from GitHub, then run NPM against the branch you want to use or test.
Using Git, clone the package repository, then enter the new directory:
git clone https://github.com/orientechnologies/orientjs.git$
When you clone the repository, Git automatically provides you with the current state of the
masterbranch. If you would like to work with another branch, like
developor test features on past releases, you need to check out the branch you want. For instance,
git checkout develop
Once you've selected the branch you want to build, call NPM to handle the installation.
Run the tests to make sure it works:
Apache 2.0 License, see LICENSE