Handles line-item arrays
wuup unwinds embedded items when a question is about products, and leaves orders whole when it's about orders.
Use case
Your orders collection already knows your revenue, best sellers and slow deliveries. Connect it read-only and ask wuup in plain English; it writes the aggregation, runs it safely and answers with a chart, a table and the query behind every number.

Who it's for
D2C founders, ops leads and analysts running a store on MongoDB
Sources
The problem today
Ask in plain English. Here is what happens behind each answer, including the query when there is one.
Matches non-cancelled orders, groups by month and charts the totals.
db.orders.aggregate([
{ $match: { status: { $ne: "cancelled" } } },
{
$group: {
_id: { $dateToString: { format: "%Y-%m", date: "$createdAt" } },
revenue: { $sum: "$total" }
}
},
{ $sort: { _id: 1 } }
])Unwinds line items and sums quantity per SKU.
db.orders.aggregate([
{ $match: { status: { $ne: "cancelled" } } },
{ $unwind: "$items" },
{ $group: { _id: "$items.sku", units: { $sum: "$items.qty" } } },
{ $sort: { units: -1 } },
{ $limit: 10 }
])Filters pending orders older than three days using $$NOW.
db.orders.find({
status: "pending",
$expr: {
$lt: [
"$createdAt",
{ $dateSubtract: { startDate: "$$NOW", unit: "day", amount: 3 } }
]
}
}, { _id: 0, orderNumber: 1, total: 1, createdAt: 1 })
.sort({ createdAt: 1 })
.limit(50)Groups non-cancelled orders by payment method and averages the total.
db.orders.aggregate([
{ $match: { status: { $ne: "cancelled" } } },
{
$group: {
_id: "$paymentMethod",
avgOrderValue: { $avg: "$total" },
orders: { $sum: 1 }
}
},
{ $sort: { avgOrderValue: -1 } }
])Counts orders per customer, then counts customers with two or more.
db.orders.aggregate([
{ $group: { _id: "$customerId", orders: { $sum: 1 } } },
{ $group: { _id: { $gte: ["$orders", 2] }, customers: { $sum: 1 } } }
])Groups by the embedded shipping city and ranks by revenue.
db.orders.aggregate([
{ $match: { status: { $ne: "cancelled" } } },
{ $group: { _id: "$shipping.city", revenue: { $sum: "$total" } } },
{ $sort: { revenue: -1 } },
{ $limit: 10 }
])Connect orders, customers, products
Scope wuup to just the collections it should read.
Ask like you'd ask an analyst
"Top 10 products by revenue last month, excluding cancelled orders."
Drill down
Use the follow-ups to split by city, payment method or customer.
wuup unwinds embedded items when a question is about products, and leaves orders whole when it's about orders.
$lookup between the collections you enabled answers questions like "top customers by spend".
Keep monthly targets in Google Sheets and ask for actual vs target in the same chat.
Every query has a 10 second time limit and returns at most 100 rows. For heavy analysis, connect a secondary or analytics replica.
It uses the amounts as stored. Mention the currency field or the currency in your question if you store several.
Only for collections you enable. Fields with sensitive names like password or token are redacted automatically; leave out collections you don't want queried.