我有相同的 ID testCaseId 'tc1' 映射到 2 个 requirementsId 'req1' 和 'req10'。下面的查询给出了 project--proj001、req--req10 和 tc--tc1 的完全匹配。我得到了解决方案,但无法将此查询转换为 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']}
]}
}}
}}
])
谢谢