如果具有与用户架构(user_id)和发布架构(object_id)相关的架构“ Like”。如何查询具有user_id = (some_uid)
和object_id = (some_uid)
的“赞”节点。
我正在使用dgraph-io/dgraph-js。
User Schema Post Schema Like Schema
uid uid uid
first_name type object_id (maps post)
last_name content user_id (maps user)
email title
created_at
答案 0 :(得分:1)
尝试一下
{
likes(func: has(like.object_id)) @filter(uid_in(like.object_id, 0x2) and uid_in(like.user_id, 0x3)){
like.object_id {
uid
post.type
post.content
post.title
}
like.user_id{
uid
user.email
user.first_name
user.last_name
}
}
}