Challenge

Project 2

1.a.db.createcollection(“customer”);

db.customer.insermany({[“_id”:1,”name”:”Sridhar”,”address”:”townhall”, “gender”:”m”},

{“_id”:2,”name”:”Harish”,”address”:”gandhinagar“,”gender”:”m”},

{“_id”:3,”name”:”Virat”,”address”:”sirisilla”,”gender”:”m”},

{“_id”:4,”name”:”Mythili”,”address”:”tirupati”,”gender”:”f”}

});

b.db.customer.add({[“customer_type”:”normal”,”customer_type”:”premium”}]);

c.db.invent.find({tags:”products”});

db.customer.add({[“product_name”:”cart”}]);

d.db.invent.insertmany([

{_id:1,item:{name:”Dress”,”category”:”Shirt”},brand:”Denin”,segments:[“shops”,”e-store”]},

{_id:2,item:{name:”Grocery”,”category”:”Biscuit”},brand:”Orea”,segments:[“shops”,”markets”]}

]);

e.db.createcollection(“category”,”subcategories”);

f.db.getcollection(‘orders’).aggregate([{

$lookup:

{

from:’products’,

localfield:’product_id’,

foreignfield:’_id’,

as:’orderdetails’

}

}]);

g.db.createcollection(“payment”);

h.db.createcollection(“admin”);

db.createcollection(“seller”);

db.seller.add([{“products”:”categories”,tags:”a”,”b”}]);

i.db.invent.find({tags:”orders”});

j.db.createcollection(“shipping”);

db.shipping.insertmany([{“_id”:1,”type”:”cash on delivery”,”order”:”dress”},

{“_id”:2,”type”:”credit card”,”card no.”:12345,”order”:”grocery”}

]);

k.db.seller.insertmany([{“_id”:5,”name”:”Yash”,”gender”:”m”,”address”:”Chennai”},

{“_id”:6,”name”:”Syed”,”gender”:”m”,”address”:”Banglore”}

]);

1.db.createcollection(1.”customer”,

2.”category”,

3.”admin”,

4.”payment”,

5.”seller”,

6.”shipping”);

Querys:

1.db.aggregatecustomer.aggregate({$avg:”order value”});

2.db.bios.find().limit(10)

db.bios.find().sort({customer:order_id}).limit(10)

db.bios.find().limit(10).sort({customer:order_id});

db.aggregatecustomer.aggregate({$lt:2});

3.db.aggregateorder.aggregate({$sum:”order_value”});

4.db.aggregatecustomer.aggregate([{$group:{_id:”$by_city”,num_tutorial:{$count:”customer_city”}}}]);

5.db.aggregatecustomer.aggregate([{$group:{_id:”$seller_city”,_id:”$product”,num_tutorial:{$sort:

“products_city”}}}]);

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.