##########################
Update:
This is the updated query that is serving the purpose, but in two different blocks.
{
user(func: eq(User.Id, "006636bf")) {
chats as ~Chat.Participants{
Chat.Id
Chat.Type
}
}
privateChats(func: uid(chats))@filter(eq(Chat.Type, "private")){
Chat.Id
Chat.Participants{
User.Id
}
}
}
Ideally it’d be better if they are unified, and participants come under chats.
##########################
There is a m to n relationship between User and Chat, with edge: Participants
My use case is, for a given User, find all the Chats the user participates in and all the other participants for that chat, if the chat is of type “private”.
My query is:
{
user(func: eq(User.Id, "006636bf")) {
~Participants {
Chat.Id
chatType as Chat.Type
Chat.Participants @filter(eq(val(chatType), "private")){
User.Id
}
}
}
}
The problem is that the the chatType filter is not working and is always evaluating to false. Means I am not getting the User.Id for the participants. Any idea why?!
If I remove the filter the values are working as expected.