Many-to-many relations in Custom Conditions (RBAC)

Hi!

I want to create a custom condition on a content type which has an “Authors” field. That field is a relation, and can contain references to multiple author content types.

In case that field would only contain ONE reference, I should probably have been able to write my handler something like this:

async handler(user: User) {
   return { Author: { Email: { $eq: user.email } } }
},

But, again, the field is Authors, not Author

I got it to work with the following:

return {
    Authors: { $elemMatch: { Email: user.email } },
}