Mongodb – Count posts of user with default value
Supposed I have a data of [ { "_id": "629eb5ced774223d36a68907", "userId": "629eb22698df1015e980a98f", "posts": [ { "_id": "629eb59ad774223d36a688fa", "title": "titletestz", "body": "bodyz", "createdAt": "2022-06-07T02:19:06.314Z", "updatedAt": "2022-06-07T02:19:06.314Z", "__v": 0 }, { "_id": "629eb59ad774223d36a688fc", "title": "titletestx", "body": "bodyx", "createdAt": "2022-06-07T02:19:06.879Z", "updatedAt": "2022-06-07T02:19:06.879Z", "__v":…