I have same ID testCaseId 'tc1' mapped with 2 requirementId 'req1' and 'req10'. This below query gives the exact match for project--proj001,req--req10 and tc--tc1. I got the solution but unable to convert this query into Spring Mongo.
db.req_tc.aggregate([
{ $match: {'project': 'proj001'}},
{ $project: {
list: {$filter: {
input: '$reqtclst',
as: 'item',
cond: {
$and: [
{$eq: ['$$item.requirementId', 'req10']},
{$eq:['$$item.testCaseId', 'tc1']}
]}
}}
}}
])
Thanks