All challenges
Orders with customer names
hard+80 XPJoin each order to its user (orders.userId → users._id) into a field called customer, unwind it, and project { total: 1, status: 1, 'customer.name': 1 }.
Sample of shop.orders
{
_id: 1001,
userId: 101,
items: [
{
productId: 1,
qty: 2
},
{
productId: 3,
qty: 1
}
],
total: 99.97,
status: "delivered",
date: "2025-05-01"
}{
_id: 1002,
userId: 102,
items: [
{
productId: 5,
qty: 1
}
],
total: 199.99,
status: "shipped",
date: "2025-05-14"
}{
_id: 1003,
userId: 101,
items: [
{
productId: 9,
qty: 1
},
{
productId: 2,
qty: 1
}
],
total: 369.98,
status: "delivered",
date: "2025-06-02"
}