How to use OrientDB in a SailsJS App

走远了吗. 提交于 2019-12-24 11:20:05

问题


I am new to NodeJS and SailsJS, was working with Rails or PHP before.

I want to use SailsJS together with OrientDB. What would be the best approach? I found two options so far, but the amount of information isn't that great (yet).

  1. Go with Waterline and this sails adapter for orientdb
  2. Go one level deeper and use the binary adapter from nodejs

Any help, tips, hints would be greatly appreciated. I am a bit lost but very excited to understand more about these great tools.

Thanks!


回答1:


You probably have figured out the answer by now but for future reference here's mine.

Adapter vs OrientDB driver

There are currently 3 OrientDB adapters for Waterline/SailsJS that I know of:

  • sails-orientdb-binary (as referred by you);
  • sails-orientdb;
  • waterline-orientdb.

Given the amount of code, commits and time spent on each I would say is better to use one of these (and probably contribute) than to go down the other route. Using one of these with SailsJS should be plug 'n play and they should also be compatible with blueprints controllers (I say should as my experience really is waterline and not so much SailsJS). On the other hand, there may be a slight performance penalty as all queries will go through waterline and adapter before they reach Oriento. Only if performance is absolutely critical I would go directly to Oriento and even so both sails-orientdb and waterline-orientdb expose a .getDB() method that return a native Oriento db object. So the adapters give you Oriento plus validations plus automatic class creation (through models) plus easy integration with SailsJS, the best of both worlds :)

Which adapter to use

sails-orientdb-binary

This is the one I have the least experience with.

  • Last commit: Nov 8, 2014 (out of 4 commits);
  • Waterline interfaces implemented: not sure, not mentioned in the package.json;
  • Automated tests: no travis.yml or indication that it passes waterline-adapter-tests;
  • "oriento": "~0.3.1": this is fairly old and does not support OrientoDB 2.0.

sails-orientdb

This seems the oldest adapter and one I have some experience with.

  • Last commit: Dec 25, 2014 (out of 45 commits);
  • Waterline interfaces implemented: semantic, queryable. No associations interface which means waterline core will handle the joins which will not make the most out the graph specific commands;
  • Automated tests: travis.yml set up, but if you got to travis-ci.org/vjsrinath/sails-orientdb it says 0 passing 1 failing;
  • "oriento": "^0.3.2": once again an old version of oriento.

waterline-orientdb

This one is a fork of sails-orientdb and seen lots of progress recently.

  • Last commit: Feb 26, 2015 (out of 421 commits);
  • Waterline interfaces implemented: semantic, queryable, associations and migratable. Joins are performed by a singe SELECT query with fetch plan;
  • Automated tests: travis.yml set up. Besides the generic 225 waterline-adapter-tests it has additional 28 unit tests and 68 integration tests all passing in both OrientDB v1.7.10 and v2.0.2;
  • "oriento": "~1.1.0": latest version as of now.

So, at the risk of sounding partial, I'm the developer of waterline-orientdb, I believe waterline-orientdb is currently the most mature OrientDB adapter for SailsJS. It has a richer feature, it's more up to date and is better tested.

UPDATE: waterline-orientdb is now called sails-orientdb and is maintained by the developers of the mentioned 3 adapters.



来源:https://stackoverflow.com/questions/27368083/how-to-use-orientdb-in-a-sailsjs-app

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!