Thanks Arve for response, but I am still not clear. My queries are simple. I am using OrientDB Javascript functions:
Just for example, if my company.employees = [#4:1, #4:5, #4:3] 1. How can I add #4:6 to linkset ? After addition it should be [#4:1, #4:5, #4:3, #4:6] 2. How can I delete #4:5 from linkset ? After deletion it should be [#4:1, #4:3, #4:6] 3. If I add #4:1 again to linkset, will it check for duplicate and return error or do I need to check problematically before adding to linset ? If I need to do it, how to do it ? I am sure there must be some methods to add, delete and check existence on linkset & linkmap, I am not just aware of those. Any pointers will be helpful. Thanks once again ! Regards, Gaurav On Thursday, March 27, 2014 9:00:36 PM UTC+5:30, Arve Knudsen wrote: > > Gaurav, regarding adding to a linkset, you may remember my question on > StackOverflow about saving document links with a document. My > answer<http://stackoverflow.com/a/22569458/265261>to that question shows how > to do this, and it looks like it would solve > your example. > > Hope this helps, > Arve > > > On Thu, Mar 27, 2014 at 12:04 PM, Gaurav Dhiman > <[email protected]<javascript:> > > wrote: > >> How to add, edit and check an existence of LINK in LINKSET ? >> >> Considering below case for *document based database*, can some on give >> me code example for add, edit and check existence cases. >> >> Lets say >> >> company.employees is LINKSET (array of links to employee objects) >> employee.company is LINK (reverse link to company object) >> >> While adding employee, I need to do two way linking (company to employee >> and employee to company), how to do it ? >> >> var emp = db.getInstance("employee"); >> emp.field("name", "John"); >> emp.field("age", "35"); >> emp.filed("company", "#2:4"); // Linked from employee to company >> company.field("employees", ?????); // How to create link from company >> to employee ? >> >> Regards, >> Gaurav >> >> -- >> >> --- >> You received this message because you are subscribed to the Google Groups >> "OrientDB" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to [email protected] <javascript:>. >> For more options, visit https://groups.google.com/d/optout. >> > > -- --- You received this message because you are subscribed to the Google Groups "OrientDB" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
