MongoDB query compiled from plain English against the ecommerce sample schema, then verified by running it.
{
"type": "aggregation",
"collection": "orders",
"pipeline": [
{},
{},
{},
{}
]
}
$group — groups by "$customerId" and aggregates totalRevenue.$lookup — joins the customers collection on _id → _id.$unwind — flattens $customer into one document per element.$project — returns only _id, customerName, totalRevenue.totalCents stores money as an integer number of cents — divide by 100 before displaying it.$group, totalRevenue totals $totalCents — one output document per distinct "$customerId".Live output from running this query against the sample dataset.
| totalRevenue | customerName |
|---|---|
| 10300 | Marcus Reid |
| 32900 | Priya Nair |
| 1400 | Sam Okafor |
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.