Challenge

Project 2

1.

db.order.aggregate ([{ "$group": { "_id": '$order', "purc_amount": {"$avg": "$purc_amount"}}}]);

2.

db.order.aggregate([{"$match":{"order_date":{$gt:2022-8-30}},$sort:{"purc_amount":-1},{limit(10)}]);

3.

db.order.aggregate([{"$match":{"order_date":{'$order':{$gt:2022-8-1,$lt:2022-8-30}}},{$group:{_id:'cus_name',"order_ithems":{$sum:$ord_items}}}}]);

4.

db.customer.aggregate([{"$group":{"_id":'$cus_city', count:{$sum:1}}}])

5.

db.getCollection('seller').aggregate([{$lookup:{from:'customer',localField:'sel_id',
foreignField:'city',as:'city'}},{$sort:{ord_items:-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.