orientjs icon indicating copy to clipboard operation
orientjs copied to clipboard

How to update an edge by using fluent api

Open tiagodavi opened this issue 8 years ago • 6 comments

Hi, can you please explain me how to update an edge by using fluent api ?

tiagodavi avatar Jan 17 '17 19:01 tiagodavi

hi @tiagodavi

do you have the record id of the edge?

wolf4ood avatar Jan 18 '17 07:01 wolf4ood

Hi. No. I just have the name of it.

On Jan 18, 2017 5:59 AM, "Enrico Risa" [email protected] wrote:

hi @tiagodavi https://github.com/tiagodavi

do you have the record id of the edge?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/orientechnologies/orientjs/issues/228#issuecomment-273408250, or mute the thread https://github.com/notifications/unsubscribe-auth/ABAmLsgWqUnThvC-qRWveptlgr_TOF2dks5rTcZ6gaJpZM4LmDuM .

tiagodavi avatar Jan 18 '17 08:01 tiagodavi

How would you filter in order to find the edge?

do you have vertices record ids or primary keys?

wolf4ood avatar Jan 18 '17 16:01 wolf4ood

I just need update "in" and o"ut" of an edge.. I have in, out and the edge name.

Does that make sense?

I have been using db.update for doing this but.. I saw on orientdb documentation that we have to use update edge instead of only update.. so I am worried about that.

Thanks.

Updates edge records in the current database. This is the equivalent of the UPDATE http://orientdb.com/docs/2.1/SQL-Update.html command, with the addition of checking and maintaining graph consistency with vertices, in the event that you update the out and in properties.

http://orientdb.com/docs/2.1/SQL-Update-Edge.html

2017-01-18 14:10 GMT-02:00 Enrico Risa [email protected]:

How would you filter in order to find the edge?

do you have vertices record ids or primary keys?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/orientechnologies/orientjs/issues/228#issuecomment-273519078, or mute the thread https://github.com/notifications/unsubscribe-auth/ABAmLp6SNUG99jF2iC4-g1SK96LEqqx8ks5rTjldgaJpZM4LmDuM .

-- Tiago Davi (MCTS) (21) 98344-4547

tiagodavi avatar Jan 18 '17 16:01 tiagodavi

I found out how to do it..

There is db.delete('EDGE', name) but there is no db.update('EDGE', name)... so

It works like orient db says..

db.update(EDGE ${name}) .set(fields) .where(conditions) .one()

tiagodavi avatar Jan 18 '17 17:01 tiagodavi

Yes @tiagodavi

if you change out/in it's better to use update edge since it will take care of updating the vertices pointers also

wolf4ood avatar Jan 19 '17 09:01 wolf4ood