Project 2
1)
| db.sales.aggregate( |
| [ |
| { |
| $group: |
| { |
| _id: "$item", |
| avgAmount: { $avg: { $multiply: [ "$price", "$quantity" ] } }, |
| avgQuantity: { $avg: "$quantity" } |
| } |
| } |
| ] |
| ) |
3) db.order.find({$order: = "month" });
4)
- db.peaks.find(
- {" Location " : [ "India" : " Mumbai"]}
- [ "America" : "Mexico"]}
- [ " Russia" : " Roose" ]}
- Query your database to get all the sellers who have base in the same city in which the customers who ordered their products. Order them in the order of highest number of products sold to customers in same city to lowest.
5) db. customerAddresses.insertOne({customerid: " 12313", address: { city: "Nashik", pincode: "147852"}});