Best index choice

Hi,

I would like to know what is the best index to create in the following situation:

I have to optimize a find operation whose filter is as follows:

let filter = {
     $or: [
          {
            "sharing.groupId" : groupId
          }.
          {
           "sharing.users": {
                $elemMatch: {
                    id: userId,
                    permission: {
                        $lte: permission
                    }
                }
            }
          }
     ]
}

let documents = db.documents.find(filter)

Inside the document, sharing property has the following type:


enum NodePermissions {
    OWNER = 1,
    EDITOR = 2,
    VIEWER = 3
}

type NodeSharing {
    groupId: string
    users: {
        id: string
        permission: NodePermissions
    }[]
}

Of course, both userId, permission and groupId are given parameters of the filter operation.

Do you have any suggestions?

Thank you.