These are chat archives for appscot/sails-orientdb

18th
Apr 2015
Nauman
@nomi-ramzan
Apr 18 2015 06:04
Hi all !
in sails-orientdb adopter
model.find({id:'12:0'}) is working...
but in array like
model.find({id:['12:0','12:1']}) i have to give #12:0 and #12:1 (ids with # sigh ) how can i fix this issue ?
Nauman
@nomi-ramzan
Apr 18 2015 11:35
Hi all is there any way to query edges on the base of in and out values in sails-orientdb or waterline ?
Dário
@dmarcelino
Apr 18 2015 11:53
Hi @nomi-ramzan, I'm actually surprised model.find({id:'12:0'}) is working. A RID is composed of #<cluster-id>:<cluster-position> (documentation).
so in other words you should always use #12:0 and not the other way around
Line no 29 _getEdgeSides
Nauman
@nomi-ramzan
Apr 18 2015 12:02
I am still looking for select from edge (item) where in (catid) = #12:2
Dário
@dmarcelino
Apr 18 2015 12:02
@nomi-ramzan, that's internal to the adapter and there would be little or no reason to use that directly. You should preferably use the waterline API - documentation or you should use the custom adapter methods provided by sails-orientdb documentation
Nauman
@nomi-ramzan
Apr 18 2015 12:05
@dmarcelino , In sails-orientdb query function is there any way to select multiple records like waterline find({id:ids}) ?
Dário
@dmarcelino
Apr 18 2015 12:05
for something like select from edge (item) where in (catid) = #12:2 you need to use many-to-many through associations
@nomi-ramzan, in .query() you can use any valid OrientDB SQL query, check: http://orientdb.com/docs/last/SQL-Query.html
Nauman
@nomi-ramzan
Apr 18 2015 12:07
:smile: many-to-many is still not available.
Dário
@dmarcelino
Apr 18 2015 12:07
through associations are not officially supported but it kind of works
at your own risk of course
Nauman
@nomi-ramzan
Apr 18 2015 12:08
:+1:
Dário
@dmarcelino
Apr 18 2015 12:09
regular many-to-many associations (not through) do work but do not provide the methods to query edges
Nauman
@nomi-ramzan
Apr 18 2015 12:09
it means that until now best option is query function .... right ?
Dário
@dmarcelino
Apr 18 2015 12:10
it's up to you to decide if you want to use many-to-many through or .query()
Nauman
@nomi-ramzan
Apr 18 2015 12:10
any suggestion ?
Dário
@dmarcelino
Apr 18 2015 12:14
I suggest you read balderdashy/waterline#705 and based on how comfortable you feel with that and your level of experience with waterline make your own decision. It will also depend on how critical your application is.
using .query() will be safer but more painful since you'll have to build the SQL queries while many-to-many through should be easier but more risky
Nauman
@nomi-ramzan
Apr 18 2015 12:17
But in query we also have some issues like
select sum(total) as g_total, count(@rid) from bills waterline is not executing this query.
Dário
@dmarcelino
Apr 18 2015 12:35
I'm not aware of any problems with .query() and no issues have been raised in github
does your query work through the console and orientdb studio?
"waterline is not executing this query" is pretty vague... you have to remember that query goes through sails-orientdb -> Oriento -> OrientDB
so the issue may have happened at any of those places
I recommend you try your query on OrientDB studio first
if it works there and not through .query(), try enabling logger to see what's going on
and finally when you figure out where the problem is, and you can't fix it, raise an issue on the appropriate github project
Nauman
@nomi-ramzan
Apr 18 2015 12:39
you can check this query in waterline count ids and sum one field and an other case
select , catid. from items
here catid is link in item record
Dário
@dmarcelino
Apr 18 2015 12:40
does your query work through the console and orientdb studio?
Nauman
@nomi-ramzan
Apr 18 2015 12:40
select , catid. from items this query is working in orientDB studio but not in Model.getDB().query('select , catid. from items')..
Dário
@dmarcelino
Apr 18 2015 12:41
what error are you getting on sails-orientdb?
Nauman
@nomi-ramzan
Apr 18 2015 12:42
let me check...
Dário
@dmarcelino
Apr 18 2015 12:42
if you are doing Model.getDB() then it would be an Oriento issue
not a sails-orientdb
Nauman
@nomi-ramzan
Apr 18 2015 12:42
ok.
Dário
@dmarcelino
Apr 18 2015 12:43
but honestly I would doubt very much that Oriento or sails-orientb would have problems with .query()
since it's highly tested
and by the way, select , catid. from items looks odd to say the least
why do you have a comma between select and catid?
what is catid?
anyway, I have to go, I would advise you to read http://orientdb.com/docs/last/SQL-Query.html and make sure you have a valid SQL query
Nauman
@nomi-ramzan
Apr 18 2015 12:49
Sorry my query is select ,catid. from items
and i just test my query its working. you r right issue was something else. :smile:
Thanx a lot for ur time. have a nice day.