title: MongoDB C# Array Filters for Complex Queries
body: <p>Iam using MongoDB C#/.NET Driver version 2.11.5. Here is my collection structure.</p>
  <p>CollectionName: Deployment</p>
  <pre><code>{
      &quot;_id&quot; : ObjectId(&quot;60263b3279357e12775bfb21&quot;),
      &quot;version&quot; : &quot;P3-V1.0&quot;,
      &quot;productId&quot; : &quot;6020f75d103d4895f12c88ec&quot;,
      &quot;hierarchy&quot; : &quot;6020f8ad103d4895f12c88ed&quot;,
      &quot;description&quot; : &quot;P3-T1-V1.0&quot;,
      &quot;policies&quot; : [ 
          {
              &quot;name&quot; : &quot;Policy-1&quot;,
              &quot;description&quot; : &quot;Policy-1&quot;,
              &quot;rules&quot; : [ 
                  {
                      &quot;subject&quot; : &quot;abc.def@xyz.com&quot;,
                      &quot;status&quot; : &quot;InProgress&quot;,
                      &quot;comments&quot; : &quot;&quot;,
                      &quot;updatedBy&quot; : &quot;&quot;,
                      &quot;approvalId&quot; : &quot;8f7c8767-6613-4aa2-9b87-7778a42512bd&quot;,
                      &quot;requestDate&quot; : ISODate(&quot;2021-02-12T08:29:32.000Z&quot;)
                  },
                  {
                      &quot;subject&quot; : &quot;ghi.jkl@xyz.com&quot;,
                      &quot;status&quot; : &quot;InProgress&quot;,
                      &quot;comments&quot; : &quot;&quot;,
                      &quot;updatedBy&quot; : &quot;&quot;,
                      &quot;approvalId&quot; : &quot;9e7c8767-6613-4aa2-9b87-7778a42512ee&quot;,
                      &quot;requestDate&quot; : ISODate(&quot;2021-02-11T08:29:32.000Z&quot;)
                  }               
              ]
          },
          {
              &quot;name&quot; : &quot;Policy-2&quot;,
              &quot;description&quot; : &quot;Policy-2&quot;,
              &quot;rules&quot; : [ 
                  {
                      &quot;subject&quot; : &quot;mno.pqr@xyz.com&quot;,
                      &quot;status&quot; : &quot;InProgress&quot;,
                      &quot;comments&quot; : &quot;&quot;,
                      &quot;updatedBy&quot; : &quot;&quot;,
                      &quot;approvalId&quot; : &quot;1a6c8767-6613-4aa2-9b87-7778a42512bd&quot;,
                      &quot;requestDate&quot; : ISODate(&quot;2021-02-12T08:29:32.000Z&quot;)
                  },
                  {
                      &quot;subject&quot; : &quot;stu.vwx@xyz.com&quot;,
                      &quot;status&quot; : &quot;InProgress&quot;,
                      &quot;comments&quot; : &quot;&quot;,
                      &quot;updatedBy&quot; : &quot;&quot;,
                      &quot;approvalId&quot; : &quot;2z0c8767-6613-4aa2-9b87-7778a42512ee&quot;,
                      &quot;requestDate&quot; : ISODate(&quot;2021-02-11T08:29:32.000Z&quot;)
                  }               
              ]
          }
      ]
  }
  </code></pre>
  <p>C# Class Names:</p>
  <p>Deployment (has multiple <code>IList&lt;Policy&gt; Policies</code>)</p>
  <p>Policy (has multiple <code>IList&lt;Rule&gt; Rules</code>)</p>
  <p>Rule</p>
  <ol>
  <li><p>What is the Update query to update status, comments and updatedBy fields in a Rule, given Policy.Name (for ex: Policy-1) and Rule.subject (for ex: abc.def@xyz.com)?</p>
  </li>
  <li><p>What is the Insert query to insert a new Rule object inside a Policy, given Policy.Name (for ex: Policy-1)?</p>
  </li>
  </ol>
  <p>Thanks for your help.</p>