Hello.
Trying to link two classes like this:
create class Post
create class Comment
create property Post.title string
create property Comment.title string
create property Post.comments LINKSET Comment
create property Comment.post Link Post
 insert into Comment content {title: 'Comment1'}

Inserted record 'Comment#17:0{title:Comment1} v1' in 0.005000 sec(s).

insert into Post content {title: 'Post1'}

Inserted record 'Post#16:0{title:Post1} v1' in 0.002000 sec(s).

Now linking:
update #17:0 SET post=#16:0
update #16:0 ADD comments=#17:0

Result:
select from Comment
----+-----+-------+--------+-----
#   |@RID |@CLASS |title   |post
----+-----+-------+--------+-----
0   |#17:0|Comment|Comment1|#16:0


select from Post
----+-----+------+-----+--------
#   |@RID |@CLASS|title|comments
----+-----+------+-----+--------
0   |#16:0|Post  |Post1|[1]

Now questions. 
1) If what I'm doing is correct way to build two-way linking for documents?
2) If yes, how can I retrieve list of comments for post?

-- 

--- 
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.

Reply via email to