This is a waterline ORM adapter which connects SailsJS app to OrientDB data store. It implements basic CRUD operations on OrientDB using both Binary and REST/HTTP protocols. NOTE: Although the name of this package specifies 'binary', but it supports both protocols (Binary + REST). NPM name was taken when REST support was not implemented, hence the old name continues.
This version of the adapter is for the v0.10+ release of Sails / Waterline. It should work with latest Sails version.
Install from NPM.
# In your app:$ npm install sails-orientdb-binary
Add the OrientDB config to the config/adapters.js file. Basic options:
moduleexportsadapters ='default': 'orientdb-bin'orientdb-bin:module : 'sails-orientdb-binary'host : 'localhost'port : 3306user : 'username'password : 'password'database : 'OrientDB Database Name';
Communicate with OrientDB using Binary & REST Protocols
Using this adapter you can do below CRUD operations on OrientDB classes over binary protocol.
Find: Select record(s) from OrientDB collection / class / table
Example usage: Below example find all those User records where id (in OrientDB its @rid - primary key) is #5:3 and name attribute is 'mike'
Insert: Add new record to OrientDB collection / class / table
Example usage: Below example inserts new record with four attributes / fields in User collection
Update: Update / change existing record(s) in OrientDB collection / class / table
Example usage: Below example will update lastName and mobileNumber attributes of max 5 records where firstName starts with 'Mike' and email is 'firstname.lastname@example.org'
Destroy: Delete existing record(s) in OrientDB collection / class / table
Example usage: Below example will delete max 5 records where firstName starts with 'Mike' and email is 'email@example.com'
Example usage: Below example calls the defined OrientDB functions getAllStates() with parameter 'India'.
Calling function over Binary Protocol:
Calling OrientDB function over REST / HTTP protocol
var options =funcName: "addUser"protocol: "http"method: "POST"params:firstName: 'Mike'lastName: 'Tyson'email: 'firstname.lastname@example.org';Users;
Waterline is a brand new kind of storage and retrieval engine.
It provides a uniform API for accessing stuff from different kinds of databases, protocols, and 3rd party APIs. That means you write the same code to get users, whether they live in MySQL, OrientDB, LDAP, MongoDB, or Facebook.
Sails is free and open-source MVC framework based on NodeJS. It is licensed under the MIT License. OrientDB is free and open-source under the Apache 2. As its open-source, you can get its sources here