appscot / sails-orientdb

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

filter based on edge in()? #156

Open grimace opened 7 years ago

grimace commented 7 years ago

I'm moving a sails application from mongo to orientdb. I'm using sails-orientdb and am trying to build a filter for a query. I'm trying to query only on Assets that are connected to a particular Network. I can do this:

    var edgeQuery =  "select from Asset where in(NET_ASSET).@rid = #3961:0 and width >= 1920"; 
    var query = dbclient.db.select(edgeQuery);
          return query.all()
                  .then(function (contents) {
                         ...etc..

which makes building my queries quite contorted since the number of parameters vary. I would like to do something like this:

    var filter = { "in(NET_USER).@rid" : "#3961:0", "width" : '>= 1920' };
    Asset.find(filter);

Then I could build my filter as needed, but so far I've had no luck. Is it possible?