Project 2
QUESTIONS:-
Ans:- 1
db.products.aggregate([{$group:{_id:'product_cost', avg:{$avg:'$product_cost'}}}])
Ans:- 2
db.customers.aggregate([{$sort: {purchase_amount:-1}])
Ans:- 3
db.order.aggregate([{$group:{_id:'Total_cost', sum:{$sum:'$product_cost'}}}])
Ans:- 4
db.customers.aggregate([{$group:{_id:'customer_city', {$match:{customer_city}}}])
Ans:- 5
db.orders.aggregate([{$match: {"customer.city": {$eq: "Seller.city"}}},
{$group:{_id: "$seller",totalProducts: {$sum: "$items.quantity"}}},{$sort: {totalProducts: -1}}])