MongoDB query compiled from plain English against the blog sample schema, then verified by running it.
{
"type": "aggregation",
"collection": "authors",
"pipeline": [
{},
{},
{},
{},
{},
{}
]
}
$lookup — joins the posts collection on _id → authorId.$unwind — flattens $posts into one document per element.$group — groups by "$_id" and aggregates name, totalViews.$sort — orders by totalViews.$limit — caps the result at 5 documents.$project — returns only _id, name, totalViews.$group, name takes the first value in the group, totalViews totals $posts.views — one output document per distinct "$_id".Write this in plain English instead. Mask Databases compiles the sentence above into exactly this query at build time — no AI at runtime, and you can read the output in a diff.
Try it in the playground → No signup, runs in your browser.