Mongodb – Flatten the nested Object in the Array of objects using Mongoose Populate
My query const users = usersWorkspaceModel .find({ workspaceId, userRole: 'supervisor', }) .select({ _id: 0, createdAt: 0, assignedBy: 0, updatedAt: 0, workspaceId: 0, }) .populate({ path: 'userId', select: ['_id', 'name', 'email'], mode: 'User', }); This returns me the following result :-…