I have a bit of trouble getting data from mongodb. I have a collection like this:
Activities = [
... some another activity object item ... ,
{
type: "special"
dates: {
begin: ISODate("2019-07-07T17:00:00.000Z"),
end: ISODate("2019-07-20T17:00:00.000Z"),
note: ""
},
status: "pending"
} ,
,
{
type: "event"
dates: {
times: {
from: "12:00",
to: "15:00"
},
begin: ISODate("2019-07-21T17:00:00.000Z"),
end: ISODate("2019-08-29T17:00:00.000Z"),
note: ""
},
status: "pending"
} ,
... some another activity object item ...
]
I want to get all activity data has : dates.begin < X (my params date) < dates.end . And this is my way i have tried :
_Activities.find({
"dates.end" : {
$lte : "2019-08-31T17:00:00.000Z"
},
"dates.begin" : {
$gte : "2019-07-15T17:00:00.000Z"
}
}, callback);
// return [];
_Activities.find({
"dates.end" : {
$lte : "2019-08-30T17:00:00.000Z"
}
}, callback);
// return [] too;
I don't know where I was wrong, anyone has a solution to help me :((( Thanks for taking the time .