db.getCollection('user').aggregate([
{$lookup: {from: "post", localField: "_id", foreignField: "userId", as: "post"}},
{$unwind: { path: "$post", preserveNullAndEmptyArrays: true }},
{$sort: {"post.createdAt": -1}},
{$group: {"_id": "$_id", "name": {$first: "$name"}, "post": {$first: "$post"}},
{$project: {"_id": 1, "name": 1, "post": 1}}
])