I have mongo documents:
{
id:1
time:[
1,
2,
10
]
}
{
id:2
time:[
1,
4,
8,
10
]
}
I want find all documents, which have time between 3 and 5 or between 7 or 9 (document with id 2). I dont know how do this.
I try:
mongo.find( $or : [{time:{$gte:3, $lte:5}}, {time:{$gte:7, $lte:9}}] )
and mongo returns documents with id 1 and 2, but i need id2 with time[4, 8].
How to apply a condition to each element of the array, but NOT to entire array?
p.s. Size array "time" maybe different