If I have a user and post collection
{\"_id\": 1, \"name\": \"User 1\"}
{\"_id\": 2, \"name\": \"User 2\"}
{\"_id\": 1, \"title\":
here is a way you can use
db.getCollection('post').aggregate([
{ $limit: 10 },
{$sort: {"createdAt": -1}},
{$lookup: {from: "user", localField: "userId", foreignField: "_id", as: "user"}},
])
you should query post which sorted by date and join with user. so if you want to provide a limit for posts then you can.