All academies
All challenges

Inventory value

hard+75 XP

For each product compute inventoryValue = price * stock, returning { name: 1, inventoryValue: 1, _id: 0 }, sorted by inventoryValue descending, top 5 only.

Sample of shop.products

{
  _id: 1,
  name: "Wireless Mouse",
  category: "electronics",
  price: 29.99,
  stock: 120,
  rating: 4.5,
  tags: [
    "wireless",
    "accessories"
  ]
}
{
  _id: 2,
  name: "Mechanical Keyboard",
  category: "electronics",
  price: 89.99,
  stock: 45,
  rating: 4.8,
  tags: [
    "mechanical",
    "rgb"
  ]
}
{
  _id: 3,
  name: "USB-C Hub",
  category: "electronics",
  price: 39.99,
  stock: 200,
  rating: 4.2,
  tags: [
    "usb",
    "accessories"
  ]
}