Consider a collection named orders with the following documents:
{
"_id" : ObjectId("5f0a7e80d8c9c7b5a48c49e1"),
"order_id" : 101,
"customer_name" : "John Doe",
"order_date" : ISODate("2022-01-01T00:00:00.000Z"),
"items" : [
{
"product_name" : "Apple",
"quantity" : 2,
"price" : 0.99
},
{
"product_name" : "Banana",
"quantity" : 5,
"price" : 0.5
}
]
}
{
"_id" : ObjectId("5f0a7e80d8c9c7b5a48c49e2"),
"order_id" : 102,
"customer_name" : "Jane Doe",
"order_date" : ISODate("2022-01-02T00:00:00.000Z"),
"items" : [
{
"product_name" : "Orange",
"quantity" : 3,
"price" : 0.79
},
{
"product_name" : "Mango",
"quantity" : 2,
"price" : 1.99
}
]
}
{
"_id" : ObjectId("5f0a7e80d8c9c7b5a48c49e3"),
"order_id" : 103,
"customer_name" : "Bob Smith",
"order_date" : ISODate("2022-01-03T00:00:00.000Z"),
"items" : [
{
"product_name" : "Peach",
"quantity" : 4,
"price" : 1.49
},
{
"product_name" : "Pear",
"quantity" : 1,
"price" : 2.99
}
]
}
What is the query to retrieve the total sales for each customer in the orders collection?