Filtering on relation in Mongo DB 1.24-beta


#1

I want to filter on a relation field but it doesn’t seem to be available for filtering.
Here is my simplified data model . . .

type User {
  id: ID! @id
  name: String!
  email: String! @unique
}

type Invite {
  id: ID! @id
  inviterId: User @relation(name: "Inviter", link: INLINE)
  inviteeEmail: String!
  inviteeId: User @relation(name: "Invitee", link: INLINE)
  status: String!
}

I’d like to filter with something like . . .

query invitedFriends {
  invites(where: {
    inviterId: "5c317f6ca7b11b000931de58"
  }) {
    inviteeEmail
  }
}

. . . but inviterId is not available for filtering on.
Is there some way I can do this?


#2

Oops, I had Docker still running on 1.22. Have upgraded and this is working now . . .

query invites {
  invites(where: { inviterId: { id: "5c35c62c857aba0009b2f00d" } }) {
    inviteeEmail
  }
}
{
  "data": {
    "invites": [
      {
        "inviteeEmail": "macy@gmail.com"
      },
      {
        "inviteeEmail": "lucy@gmail.com"
      }
    ]
  }
}

#3

This topic was automatically closed 45 days after the last reply. New replies are no longer allowed.