title: How to print minimum result in MongoDB
body: <p>MongoDB noob here...</p>
  
  <p>So, I'm trying to print out the minimum value score inside a collection that looks like this...</p>
  
  <pre><code>        &gt; db.students.find({'_id': 1}).pretty()
          {
                  "_id" : 1,
                  "name" : "Aurelia Menendez",
                  "scores" : [
                          {
                                  "type" : "exam",
                                  "score" : 60.06045071030959
                          },
                          {
                                  "type" : "quiz",
                                  "score" : 52.79790691903873
                          },
                          {
                                  "type" : "homework",
                                  "score" : 71.76133439165544
                          },
                          {
                                  "type" : "homework",
                                  "score" : 34.85718117893772
                          }
                  ]
          }
  </code></pre>
  
  <p>The incantation I'm using is as such...</p>
  
  <pre><code>db.students.aggregate(
      // Initial document match (uses index, if a suitable one is available)
      { $match: {
          _id : 1
      }},
  
      // Expand the scores array into a stream of documents
      { $unwind: '$scores' },
  
      // Filter to 'homework' scores 
      { $match: {
          'scores.type': 'homework'
      }},
  
      // grab the minimum value score
      { $match: {
          'scores.min.score': 1
      }}
  )
  </code></pre>
  
  <p>the output i'm getting is this...</p>
  
  <pre><code>{ "result" : [ ], "ok" : 1 }
  </code></pre>
  
  <p>What am I doing wrong?</p>