OrientDB-API for NodeJS

699 views
Skip to first unread message

TheOutlander

unread,
May 7, 2012, 11:51:42 PM5/7/12
to orient-...@googlegroups.com
I'm trying to access OrientDB via NodeJS. I came across the OrientDB-API.js, but that code only works through the browser as it uses JQuery. 

When I tried to include JQuery in my project, it complained about window (as that will only resolve on the browser).

I know I can write one in Javascript, but before I do that I was wondering if there's a NodeJS driver for OrientDB? 

Thanks,
Nick

hkgrani

unread,
May 8, 2012, 3:00:35 AM5/8/12
to orient-...@googlegroups.com
Hi

This is the one with activity : https://github.com/gabipetrovay/node-orientdb

Currently using the binary-protocol but http is planned it seems

Hans 

TheOutlander

unread,
May 9, 2012, 3:52:06 AM5/9/12
to orient-...@googlegroups.com
Thanks for the link. I've tried that but keep getting a protocol not supported. It's using the port for binary protocol. 
There's an error listed in the issues regarding that.

I think I'm going to implement a REST connector for now.

-Nick

Gabriel Petrovay

unread,
May 10, 2012, 11:39:30 AM5/10/12
to orient-...@googlegroups.com
Hi Nick,

What do you mean with: "It's using the port for binary protocol."


The new version should be published tomorrow-ish. This version will implement protocol version 9. I will check if the issue is fixed before publishing it (after Federico's rc9 branch merge in https://github.com/gabipetrovay/node-orientdb)

Regards,
Gabriel

TheOutlander

unread,
May 11, 2012, 2:32:56 AM5/11/12
to orient-...@googlegroups.com
Hi Gabriel,

Since the error message said "protocol not supported", I wanted to mention that I was connecting on the port that supported binary protocol (2424) as opposed to the RESTful protocol (2480).

Thanks for publishing the new version. I'm looking forward to using it. In the meanwhile, I'm writing the RESTful client in Server-side Javascript in case I run into more issues with your driver.

Thanks,
Nick

TheOutlander

unread,
May 16, 2012, 2:02:00 AM5/16/12
to orient-...@googlegroups.com
Gabriel,

Thanks for releasing the fix quickly! The new version works!! 

I have a few questions:

1. Is the binary driver production ready? 

2. I understand that about 6 commands aren't implemented, which are sort of a lower priority...is that right?

3. What is your plan for the HTTP driver? I've ported the existing Javascript client side REST connector, but I'm facing issues using it for some odd reason I'm trying to figure out. Also, I know the existing Javascript driver has to be run from the OrientDB\www folder to avoid cross-domain requests. How can this issue can be avoided with a NodeJS REST connector? Would I have to use JSONP? If you help me identify this issue, I will have the REST connector working and can share it as part of your library!

Thanks,
Nick

On Thursday, May 10, 2012 8:39:30 AM UTC-7, Gabriel Petrovay wrote:

TheOutlander

unread,
May 21, 2012, 2:14:01 AM5/21/12
to orient-...@googlegroups.com
Ping.

Gabriel Petrovay

unread,
May 21, 2012, 1:00:36 PM5/21/12
to orient-...@googlegroups.com
Hi Nick,

Sorry for delay, I has a few days completely off(line) :)


On Monday, May 21, 2012 8:14:01 AM UTC+2, TheOutlander wrote:
Ping.

On Tuesday, May 15, 2012 11:02:00 PM UTC-7, TheOutlander wrote:
Gabriel,

Thanks for releasing the fix quickly! The new version works!! 

I have a few questions:

1. Is the binary driver production ready? 

Not yet ready for production. But we are using it already. As we grow we expect to hit more problems and correct them on the way.
 

2. I understand that about 6 commands aren't implemented, which are sort of a lower priority...is that right?


The short answer is: currently not a priority for us. If somebody needs one of the commands there, it should be straight forward to implement them having the other command examples. We are currently just using OrientDB and don't bother with it's performance yet (data segments, transactions) since we are working mainly on our main product. But in my opinion it is a must to have them in the "orientdb" node.js module 1.0 (for completeness). 
 
3. What is your plan for the HTTP driver?

I am dreaming of having an option where one can specify: { "protocol": "binary/http" } With this, just the communication layer should change and use HTTP request instead of sockets. But this in not in the roadmap yet.
 
I've ported the existing Javascript client side REST connector, 

Let me understand: so this is the API described here, right? http://code.google.com/p/orient/wiki/JavascriptAPI 
 
but I'm facing issues using it for some odd reason I'm trying to figure out. Also, I know the existing Javascript driver has to be run from the OrientDB\www folder to avoid cross-domain requests.

Do you want to run this code directly from browser or from Node? I assume that from Node (since our library is a node.js module). Or does node complain about cross-domain requests?!?
 
How can this issue can be avoided with a NodeJS REST connector? Would I have to use JSONP?

Just describe/ give an example scenario for me to have a more clear picture. Thanks!

 
If you help me identify this issue, I will have the REST connector working and can share it as part of your library!

That would be really great (if I we both understand the same thing: having an HTTP communication layer that the orientDB nodeJS driver can speak.)

TheOutlander

unread,
May 22, 2012, 3:47:26 AM5/22/12
to orient-...@googlegroups.com
No worries! Yes it is the Javascript API implementation found here:  http://code.google.com/p/orient/source/browse/trunk/server/src/site/js/orientdb-api.js. I've converted it to use Sockets from NodeJS. I think having that option would be great to specify a protocol.

I want to run the code from NodeJS. I was wondering if that would be considered a cross-domain request since NodeJS will be running on one port and OrientDB Web Server will be running on another (both on the same domain though). However, Luca had mentioned that it won't be treated as a cross-domain request. I need to try it out. For now, I'm focusing on building my product so won't get a chance to try HTTP any time soon. However, I'd be happy to contribute back to your library once I figure it out.

Why don't I ping you once I get back to it and run into any issues?

Thanks,
Nick
Reply all
Reply to author
Forward
0 new messages