I have a query that works in MQL. I need to translate it into Java. The query in MQL looks like this
db.<collection>.aggregate( [
{
$project: {
"MonitoringLocationIdentifier": 1,
epochTimes: {
$filter: {
input: "$epochTimes",
as: "epochTime",
cond: { $and: [ {$gte: [ "$$epochTime", NumberLong("0") ]}, {$lte: ["$$epochTime", NumberLong("558268020000")]} ]}
}
},
}
}
] )
The collection contains documents that look like this
{"_id" : ObjectId("633218dfec534a6fe90106b8"),
"MonitoringLocationIdentifier": "Site1",
"epochTimes" : [ NumberLong("451058760000"), NumberLong("558189720000"), NumberLong("516460860000") ] }
I am trying to get all the documents in the collection but filter the "epochTimes" for every document by a min/max.
Any Java Driver wizards out there?