我想从用户的帖子中获取所有帖子以及我自己的帖子,以创建新闻提要。
g.V().has('name', 'Bob').both('is_friend').out('has_posted').as('posts')
上面的代码仅返回关注的用户的帖子。
我如何包含自己的帖子?
答案 0 :(得分:0)
您可以使用union
和identity
步骤:
g.V().has('name', 'Bob').union(
both('is_friend'),
identity())
.out('has_posted').as('posts')
您可以看到问题的“实时”示例here(只需运行查询)