With my data structure like shown below I want to do some aggregation on specific datasets. I need all datasets with first target score of 3.
But I also need to get only datasets in a specific time interval. In my case I need all datasets with admission time between 8 am and 4 pm. How do I do that?
structure
{
"_id" : ObjectId("5d7f6a937563a63c1d8b4639"),
"admission" : ISODate("2019-09-16T10:27:20.197Z"),
"target" : [
{
"score" : 3
},
{
"score" : 2
}
]
}
get datasets with score of 3
db.data.aggregate([
{
$match : {"target.0.score": 3}
},
{
// ...
}
])