Project 2
db.customer.insertMany([{"cust_id":1,"custo_name":"anitha","cust_email":"[email protected]","order_id":10,"cust_city":"Telangana","seller_id":20,"cust_address":"HYD MEDCHAL","delivey_date":12/10/2022,"pro_id":30,"Admin_id":50,"cust_num":1234567890","cust_type":"normal"}]),
[{"cust_id":2,"custo_name":"anil","cust_email":"[email protected]","order_id":11,
"seller_id":21,cust_address":"DELHI MEDCHAL","delivey_date":12/11/2022,"pro_id":31,"Admin_id":50,"cust_num":9234567890","cust_type":"premium"}]);
db.seller.insertMany([{"seller_id":20,"seller_name":"sandy","order_id":10,"pro_id":30,"sell_city":"Telangana","seller_gen":"male","seller_num":9876543212,"seller_Email":"[email protected]","seller_pw":"Anit@123",}]),
[{"seller_id":22,"seller_name":"sandy","order_id":10,"pro_id":32,"sell_city":"Telangana","seller_gen":"male","seller_num":9876543212,"seller_Email":"[email protected]","seller_pw":"Anit@124",}]);
db.Admin.insertMany({"Admin_id":1,"Admine_name":"Dany","Admine_pw":"A@123","Admin_city":"HEDERABAD","Admin_Email":"[email protected]","Admin_num":8976543231","Admin_add_pro":"Books"}),
([{"Admin_id":2,"Admine_name":"Dany","Admine_pw":"A@1256","Admin_city":"HEDERABAD","Admin_Email":"[email protected]","Admin_num":8976543231","Admin_add_pro":"Mobiles}]);
db.product.insertMany({"pro_id":30,"pro_catogory":"Mobiles"{"pro_sub_category":"note10s"},"pro_Tags":"A","pro_discount":"10%","pro_cost":15000,"pro_payment":"Online","pro_rating":"****","pro_id":"15","orer_id":15,"cust_id":16,"pro_status":"tommoro delivered","pro_brand":"samsung"}),
([{"pro_id":30,"pro_catogory":"Mobiles"{"pro_sub_category":"note10s"},"pro_Tags":"A","pro_discount":"10%","pro_cost":15000,"pro_payment":"Online","pro_rating":"****","pro_id":"15","orer_id":15,"cust_id":16,"pro_status":"tommoro delivered","pro_brand":"samsung"}]);
db.order.insertMany({"ord_id":1,"seller_id":10,"cust_id":15,"ord_quality":"verygood","ord_bill":"paied","pro_id":22,"ord_adress":"medchal","ord_shipping":"already shipped"});
([{"ord_id":1,"seller_id":10,"cust_id":15,"ord_quality":"verygood","ord_bill":"paied","pro_id":22,"ord_adress":"medchal","ord_shipping":"already shipped"}]);
db.cart.insertMany({"cart_id":1,"cust_id":15,"ord_id":21,"seller_id":31,"pro_id":34,"Tags":"ABC","Pro_status":"shipped"});
([{"cart_id":1,"cust_id":15,"ord_id":21,"seller_id":31,"pro_id":34,"Tags":"ABC","Pro_status":"shipped"}]);
1.db.customer.aggregate({_id:"cust_id",avgerage.order:($avg:"order")});
2.db.customer.find({cust_name:{$lt:2022-8-12}}).sort({order:-1}).limit(10);
3.db.ordere.find({sum:{$recieved:2022-12-20}});
4.db.customer.aggregate($group:{_id:$cust_city,count:{$sum:1,cust_name:1}}]);
5.db.getcollection("customer").aggregate([{
$llokup:
{
from:seller,
localField:cust_city
foregincity:seller_city,
as:customerDetails
}
},
$sort:{
seller_id:-1
}
};