edge "likes" like as facebook

13 views
Skip to first unread message

Alexander V. Tihonov

unread,
Feb 24, 2020, 7:49:49 AM2/24/20
to ArangoDB
Situation:
There is a user, there is a post that the user can create, and there are comments that the post may have. it turns out 3 collections: users, posts, commentsQuestion:
How to organize likes?Assumption (2 options that I see):
1. Perhaps you need to create 1 collection of edge (likes) and associate with documents:
Like user:
{_from: 'user/123', _to: 'user/456'}
Like post:
{_from: 'user/123', _to: 'post/789'}
like comment:
{_from: 'user/123', _to: 'comment/654'}2. Create a collection of edges for each entity (userlikes, postlikes, commentlikes)Tell me how to do it correctly in order to speed up the calculation as much as possible:
a) how many likes and who put them on the post
b) to whom / what the user likeJust starting to understand arangodb so don’t scold for stupid questions. I read Doc, but there are so many options and which one will be more optimal is hard to understand.

Alexander V. Tihonov

unread,
Feb 24, 2020, 10:04:01 AM2/24/20
to ArangoDB
and how to stop data duplication?
I can now add this (in likes edge):
{"_from":"users/2","_to":"posts/335115"}
{"_from":"users/2","_to":"posts/335115"}
but it should not be so.

понедельник, 24 февраля 2020 г., 15:49:49 UTC+3 пользователь Alexander V. Tihonov написал:
Reply all
Reply to author
Forward
0 new messages