title: How to get all matching items from a array of objects in MongoDB?
body: <p>I have a mongo document like below</p>
  
  <pre><code>{
      "_id" : ObjectId("588adde40fcbbbc341b34e1c"),
      "title" : "Fifa world cup",
      "tags" : [ 
          {
              "name" : "Football",
              "type" : "Sports"
          }, 
          {
              "name" : "World cup",
              "type" : "Sports"
          }, 
          {
              "name" : "Fifa",
              "type" : "Manager"
          }
      ]
  }
  </code></pre>
  
  <p>I wrote the below query to get all the tags with type <code>Sports</code> but I am only getting 1 item instead of 2</p>
  
  <pre><code>db.collection.find(
  { 
      tags: 
      { 
          $elemMatch: 
          { 
                  type: "Sports" 
          }
      }
  },
  {
      "tags.$" : 1
  })
  </code></pre>
  
  <p>Is it possible to get all the matching items? What I am missing here?</p>