title: How get query for array of objects in Mongodb?
body: <p>I need to form a query in such a way to get only <strong>status : active</strong> list. It should list only the active status. need to filter it down .</p>
  <pre><code>&quot;users&quot; : {
                  &quot;assigned&quot; : [
                          {
                                  &quot;userId&quot; : ObjectId(&quot;5d9fd84b3d598088d2ea5e0b&quot;),
                                  &quot;firstName&quot; : &quot;ramasamy&quot;,
                                  &quot;userImage&quot; : &quot;69_20160719103303_user.png&quot;,
                                  &quot;status&quot; : &quot;inactive&quot;,
                                  &quot;assignedDate&quot; : ISODate(&quot;2017-05-25T05:18:37Z&quot;)
                          },
                          {
                                  &quot;userId&quot; : ObjectId(&quot;5d9fd8233d598088d2ea5dd1&quot;),
                                  &quot;firstName&quot; : &quot;karthik&quot;,
                                  &quot;userImage&quot; : &quot;karthik_1589782232510.jpeg&quot;,
                                  &quot;status&quot; : &quot;active&quot;,
                                  &quot;assignedDate&quot; : null
                          }],
                          &quot;incharge&quot; : [{
                                  &quot;userId&quot; : ObjectId(&quot;5d9fd81f3d598088d2ea5dcc&quot;),
                                  &quot;firstName&quot; : &quot;sathish&quot;,
                                   &quot;status&quot; : &quot;inactive&quot;,
                                  &quot;assignedDate&quot; : ISODate(&quot;2017-04-12T16:43:24Z&quot;)
                          },
                          { &quot;userId&quot; : ObjectId(&quot;5d9fd8203d598088d2ea5dcd&quot;),
                                  &quot;firstName&quot; : &quot;santhana vadivelan&quot;,
                                  &quot;status&quot; : &quot;active&quot;,
                                  &quot;assignedDate&quot; : ISODate(&quot;2017-05-09T18:20:25Z&quot;)
                          }]
                  }
  </code></pre>
  <p>I tried using find query,but noting worked out.</p>
  <p>I need the result to be like.</p>
  <pre><code>&quot;users&quot; : {
                  &quot;assigned&quot; : [
                          {
                                  &quot;userId&quot; : ObjectId(&quot;5d9fd8233d598088d2ea5dd1&quot;),
                                  &quot;firstName&quot; : &quot;karthik&quot;,
                                  &quot;userImage&quot; : &quot;karthik_1589782232510.jpeg&quot;,
                                  &quot;status&quot; : &quot;active&quot;,
                                  &quot;assignedDate&quot; : null
                          }]
                          &quot;incharge&quot; : [{ &quot;userId&quot; : ObjectId(&quot;5d9fd8203d598088d2ea5dcd&quot;),
                                  &quot;firstName&quot; : &quot;santhana vadivelan&quot;,
                                  &quot;status&quot; : &quot;active&quot;,
                                  &quot;assignedDate&quot; : ISODate(&quot;2017-05-09T18:20:25Z&quot;)
                          }]
                  }
  </code></pre>