Hey everyone, We recently started using SpiceDB. ...
# spicedb
l
Hey everyone, We recently started using SpiceDB. So far, so good. However, we have a case where we need to determine if a user has at least one connection to a list. I've included the relevant part of our schema (I've omitted
permission
due to them being fairly obvious but please let me know if you require anything further:
Copy code
definition user {
}

definition list {
   relation children: section
}

definition section {
}

// There can be 100,000s objects per list
definition object {
    relation parent: list
}

// There are 10-20 sections per object
definition object_section {
    relation parent: section
    relation viewer: user
}
We tried use prefixed IDs for the object_sections e.g. LIST_ID_... and then doing a read relationships with a prefix and limit of 1 to determine if they have access. However, there isn't a suitable index in place to take care of this. There's a good chance we've entirely misunderstood something and this is a relatively easy lookup. We've tried a few different combinations but are struggling to figure out a way to do this efficiently. Any help would be greatly appreciated!