appscot / sails-orientdb

OrientDB adapter for Waterline / Sails.js ORM
MIT License
25 stars 23 forks source link

Support Live Queries #74

Open tommykennedy opened 9 years ago

tommykennedy commented 9 years ago

Orientdb has just added a branch for being able to do pub/sub and reactive programming (stream processing).

It would be great to get this added to sails-orientdb

http://www.slideshare.net/Codemotion/dell-aquila-codemotionrome2015

dmarcelino commented 9 years ago

Hi @tommykennedy, it's not likely that sails-orientdb will support OrientDB 2.1 due to the bug orientechnologies/orientdb#3619, which the OrientDB folks are only planning to fix on v2.2. I've tried to convince Luca to fix this on 2.1 but he didn't budge... You can check our 2.1 status in #52.

Regarding live queries specifically, it's probably a good idea to wait for the changes to reach Oriento master. Anyway, for now you can do:

//...
var db = SomeModel.getDB();
db.liveQuery("live select from Chat")
  .on(function(data){
    io.emit(/*...*/);
  });
//...