I have a GraphQL schema that looks like this:
type User {
firstName: String
lastName: String
email: String
groups: [Group] @relation(name: "members")
}
type Group {
name: String
members: [User] @relation(name: "members")
startDate: String
}
This creates an index called members_by_group
and a Collection called members
.
If I preform a deleteUser mutation:
mutation{
deleteUser(id:"329431630822244946"){
_id
}
}
The user is not “unlinked” from the group, and the members
collection still contains the following record:
{
"ref": Ref(Collection("members"), "351058485137375832"),
"ts": 1671054310890000,
"data": {
"groupID": Ref(Collection("Group"), "329795413068481106"),
"userID": Ref(Collection("User"), "329431630822244946")
}
}
This results in Instance not found
errors when Querying the group:
findGroupByID(id: $id){
_id
startDate
members{
data{
_id
firstName
lastName
}
}
}
What is the proper way to delete items via GraphQL so that the corresponding collections and indexes update correctly? Do I need a to create a function? What would a cascading delete function in FQL look like? Thanks in advance.