I have a schema similar to

{
   'user_id' : 1,
   'marks' : [10, 40]
}

I want to find the number of users who have scored marks between 20 and 30 at least once.

I tried the following query

db.users.count({
   'marks' : {$gte: '20', $lt: '30'}
})

But this also included those with marks more than 30 ...

Edit
Report