I have a fairly simple merge aggregation that runs nightly to update some statistics in a users collection. The three collections are decent sized but not humongous. Since my Atlas cluster was updated to 6.0.8, the aggregation just runs forever (days) and I’ve been forced to kill it. I can reproduce the problem on two Atlas clusters running 6.0.8 and confirm the agg runs fine on my local develop machine on 6.0.6. Not even sure where to begin troubleshooting this. Anyone else seen issues with 6.0.8?
[
{$match:{ "stats.dateLastLogin":{ $gt:now().add("d",-30) } }}
,{$lookup:{from:"posts", let:{member:"$memberID"}, as:"posts", pipeline:[
{$match:{$expr:{$eq:["$member","$$member"]}}}
,{$group:{_id:nullValue(), cnt:{$sum:1}, cntActive:{$sum:{$cond:[{$eq:["$status","ACT"]},1,0]}}}}
]}}
,{$unwind:{path:"$posts", preserveNullAndEmptyArrays:true}}
,{$addFields:{"stats.numPosts":{$ifNull:["$posts.cnt",0]}, "stats.numPostsActive":{$ifNull:["$posts.cntActive",0]}}}
,{$project:{"posts":0}}
,{$lookup:{from:"views", let:{member:"$memberID"}, as:"views", pipeline:[
{$match:{post:{$exists:1}, $expr:{$eq:["$member","$$member"]}}}
,{$group:{_id:nullValue(), cnt:{$sum:1}, last:{$max:{$toDate:"$_id"}}}}
]}}
,{$unwind:{path:"$views", preserveNullAndEmptyArrays:true}}
,{$addFields:{"stats.numPostViews":{$ifNull:["$views.cnt",0]}, "stats.dateLastPostView":{$ifNull:["$views.last","$$REMOVE"]}, "stats.searchGeniusCandidate":{$cond:{if:{$lt:[{$ifNull:["$views.last",createDate(1972,9,4)]},createDate(2016,4,2)]},then:"$$REMOVE",else:true}}}}
,{$project:{"views":0}}
,{$project:{stats:1}}
,{$merge:{into:"members", on:"_id"}}
];