Challenge

Project 2

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}}])

Your portfolio, next

Ship work like this
in your own course.

Talk to a career counsellor

Free 20-minute call. We'll map the right course to where you want to work.

By submitting you agree to our Terms and Privacy Policy.