I have a Mongo query that should be converted to Java Spring-boot code,
Query
db.orgConfigData.aggregate([
{"$match" : { "organizationId": 339975}},
{$project: {
domains:{
$filter: {
input: "$domains",
as : "domains",
cond: {$eq: ["$$domains.activeInd", true]}
}
}}
}])
I have tried using the below code for the beginning but got stuck on how to add a filter in the projection in java spring
MatchOperation matchStage = Aggregation.match(new Criteria("organizationId").is(orgId));
ProjectionOperation projectStage = Aggregation.project(?);
can someone help me with the code for the above query? Thanks in advance.