title: mongo db querying array values with greater and less than
body: <p>I have a schema similar to</p>
  
  <pre><code>{
     'user_id' : 1,
     'marks' : [10, 40]
  }
  </code></pre>
  
  <p>I want to find the number of users who have scored marks between 20 and 30 at least once.</p>
  
  <p>I tried the following query</p>
  
  <pre><code>db.users.count({
     'marks' : {$gte: '20', $lt: '30'}
  })
  </code></pre>
  
  <p>But this also included those with marks more than 30 ... </p>