title: Array of Embedded Documents: comparison between fields and value
body: <p>I'm approaching MongoDB and I have a database with this structure:</p>
  
  <pre><code>{ "_id" : 14185, "ranges" : [ { "first" : 17, "last" : 19 }, { "first" : 6, "last" : 9 } ] }
  { "_id" : 16478, "ranges" : [ { "first" : 26, "last" : 30 }, { "first" : 3, "last" : 5 } , { "first" : 3, "last" : 5 } ] }
  { "_id" : 17896, "ranges" : [ { "first" : 124, "last" : 130 }, { "first" : 140, "last" : 146 } ] }
  </code></pre>
  
  <p>So, I always have the <code>"ranges"</code> array, containing many documents: each one of these, has a <code>"first"</code> and <code>"last"</code> value. </p>
  
  <p>Given a value, such as <code>29</code>, I'd like to write a query which gives me something like</p>
  
  <pre><code>{ "_id" : 16478, "ranges" : [ { "first" : 26, "last" : 30 } ] }
  </code></pre>
  
  <p>Is it possible?</p>