开发者

friends of friends in mongodb

开发者 https://www.devze.com 2023-02-08 13:24 出处:网络
Is there a way to do something like friends of friends in mongodb... In mysql it was select friend_id from friends 开发者_StackOverflow社区where user_id IN (select friend_id from friends where user_i

Is there a way to do something like friends of friends in mongodb... In mysql it was

select friend_id from friends 开发者_StackOverflow社区where user_id IN (select friend_id from friends where user_id = id)`


You have to perform multiple queries unless you are able to store your data as nested data structure inside one document


embeds friendship?

and in your friendship model have a friender and a friendee with request and accept date.

0

精彩评论

暂无评论...
验证码 换一张
取 消