title: Add two new fields inside the array object if conditions meet in mongodb collection
body: <pre><code>[
    {
      &quot;Empname&quot;: &quot;Doug&quot;,
      &quot;Group&quot;: [
        {
          &quot;Category&quot;: [
            {
              &quot;Categoryid&quot;: 123,
              &quot;Categoryname&quot;: &quot;science&quot;
            },
            {
              &quot;Categoryid&quot;: 233,
              &quot;Categoryname&quot;: &quot;Maths&quot;
            }
          ]
        }
      ]
    },
    {
      &quot;Empname&quot;: &quot;stark&quot;,
      &quot;Group&quot;: [
        {
          &quot;Category&quot;: [
            {
              &quot;Categoryid&quot;: 123,
              &quot;Categoryname&quot;: &quot;science&quot;
            },
            {
              &quot;Categoryid&quot;: 144,
              &quot;Categoryname&quot;: &quot;language &quot;
            }
          ]
        }
      ]
    }
  ]
  </code></pre>
  <p>Here I want to insert two fields if it meets the following conditions</p>
  <pre><code>{
    &quot;Categoryid&quot;: 123,
    &quot;Categoryname&quot;: &quot;science&quot;
  }
  </code></pre>
  <p>output should be like</p>
  <pre><code>[
    {
      &quot;Empname&quot;: &quot;Doug&quot;,
      &quot;Group&quot;: [
        {
          &quot;Category&quot;: [
            {
              &quot;Categoryid&quot;: 123,
              &quot;Categoryname&quot;: &quot;science&quot;
              &quot;CategoryLabel&quot;: &quot;Hex&quot;,
              &quot;CategoryCode&quot;: &quot;Hex-D&quot;,
            },
            {
              &quot;Categoryid&quot;: 233,
              &quot;Categoryname&quot;: &quot;Maths&quot;
            }
          ]
        }
      ]
    },
    {
      &quot;Empname&quot;: &quot;stark&quot;,
      &quot;Group&quot;: [
        {
          &quot;Category&quot;: [
            {
              &quot;Categoryid&quot;: 123,
              &quot;Categoryname&quot;: &quot;science&quot;,
              &quot;CategoryLabel&quot;: &quot;Hex&quot;,
              &quot;CategoryCode&quot;: &quot;Hex-D&quot;,
            },
            {
              &quot;Categoryid&quot;: 144,
              &quot;Categoryname&quot;: &quot;language &quot;
            }
          ]
        }
      ]
    }
  ]
  </code></pre>