Check of referenced documents

Hi guys,

I try to manage the following scenario with realm rules to read data with graphql:

The customer of the RFQ object must be hidden until the RFQ has been awarded to a supplier.
Only the supplier is able to read the customer.
This can be done by a rule which hides the customer field in the RFQ document and only shows it, if I am the supplier.

But I want to control this access on company collection level.

_id : oid
customer : company._id
supplier: company._id
status: string ["AWARDED"]

 _id :oid
name :string

rfq response if not awarded:

rfq: {
customer: null, <— check on read if current user belongs to the rfq.supplier company
supplier: {
_id: ,
name: “my company”
status: “OPEN”

When I read the RFQ, the referenced customer (company) is getting read. So, I need a rule which checks the field rfq.suppier._id of the surrounding document.

What I want in general now is a rule like:

  "%%**<RFQ>**.supplier._id": {
    "%stringToOid": ""

Thanks you :slight_smile: