title: How to use $in inside $or operator in MongoDb?
body: <p>I have the data as following documents...</p>
  
  <pre><code>[
    {
      "_id":"5e93193f755fc5e74beb5e8f",
      "orgs":[
        {
          "type":"NonEmployee",
          "roles":[]
        },
        {
          "type":"Founder",
          "roles":[
            {
              "_id":"5e44fd4546b3954e6930e83d",
              "name":"ADMIN"
            },
            {
              "_id":"5e44fd4546b3954e6930e83e",
              "name":"EMPLOYEE"
            }
          ]
        }
      ]
    }
  ]
  </code></pre>
  
  <p>The query which I am interested in is,
  Filter Documents based on "OR" conditions of the following...</p>
  
  <ul>
  <li>If it has type as NonEmployee</li>
  <li>If it has role in given Array eg. rolesArray = ['EMPLOYEE']</li>
  </ul>
  
  <p>The sub-query in aggregate looks something like this,</p>
  
  <pre><code>{
    $match: {
       $expr: {
        $or: [
          {
            $in: ["$orgs.roles.name", rolesArray]
          },
          {
            $eq: ['$orgs.type', 'NonEmployee']
          }
        ]
      }
    }
  }
  </code></pre>
  
  <p>This gives result as an empty array, because query is incorrect. Is there any possible way to achieve this?</p>