title: Left join with group by and having clause in mongoose
body: <p>I have one collection named <strong>users</strong> and second collection named <strong>videos</strong>. I want to perform left join with group by and having clause. I know how to do in mysql but not getting how to get it in Mongoose.</p>
  <p>Below are my collections<a href="https://i.stack.imgur.com/bntII.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/bntII.png" alt="enter image description here" /></a></p>
  <p>in mysql query can be like</p>
  <p>&quot;<strong>select u.id,u.masterid, count(v.vid) from users u left join videos v on u.id=v.uid group by u.id having u.masterid=1</strong>&quot;</p>
  <p>I have found few solutions related to group by or left join <a href="https://stackoverflow.com/questions/59802026/left-join-with-group-by-in-mongodb">here</a> but not with having clause. Any help is appreciated.</p>
  <p>Thanks</p>