Database
[{"dayCount":3,"dayRange":["2021-05-27","2021-05-28","2021-05-29","2021-05-30","2021-05-31","2021-06-01","2021-06-02"],"totalUserCount":4,"userCountPerDay":[{"createdAt":"2021-05-28","userCount":2},{"createdAt":"2021-06-02","userCount":1},{"createdAt":"2021-06-01","userCount":1}]}]
Query
db.collection.aggregate([{$project:{dayCount:1,totalUserCount:1,userCountPerDay:{$map:{input:"$dayRange",in:{$cond:[{$in:["$$this","$userCountPerDay.createdAt"]},{$arrayElemAt:["$userCountPerDay",{$indexOfArray:["$userCountPerDay.createdAt","$$this"]}]},{createdAt:"$$this",userCount:0}]}}}}}])