Challenge

Project 2

use ecommerce;

db.createCollection("Customer")

db.customer.insertMany ([{name : "Kartik", address: "Delhi", city: "Delhi", region: "", state: "Maharastra", country: INDIA", delivery_notes: "Leave at the gate" , Phone_no : 1234266, age : 32, gender : "Male",

Price : Rs 2000, payment_Type:["Upi", "Google", "Phone_pay" },

{name : "Ajay", address: "Bandra 1343", city: "Mumbai", region: "", state: "Maharastra", country: "INDIA", delivery_notes: "Leave at the gate" , Phone_no : 1234366, Price : Rs 8000, age : 50, gender : "Male", payment_Type:["Upi", "Google", "Phone_pay" },

{name : "Salmen", address: "galaxy 134", city: "Mumbai", region: "", state: "Maharastra", country: "INDIA", delivery_notes: "Leave at the gate" , Phone_no : 1234566, Price : Rs 5000, age : 55, gender : "Male", payment_Type:["Upi", "Google", "Phone_pay" }

{customer : "Premium"},

{customer : "Normal"},

{customer : "view Product", customer : "Add Cart"} ])

db.createCollection ("Product")

db.Product.insertMany ([

{product : {sku : 45311,

title : "Simsong mobile phone",

description : "the greates android phone",

manu_detail : {

model_number : "A654S",

relaese_date : new ISODATE("2022-05-17T08:14:15.656")

},

shipping_detail : {

weight: 350,

width: 10,

height: 10,

depth: 1

},

quantity : 99,

pricing: { price: 1000 }

}} ] )

db.createCollection ("carts")

db.carts.insert({ _id: "the_users_session_id", status:"active", quantity: 2, total: 2000, products: []});

db.createCollection ("orders")

db.orders.insert([{ created_on: new ISODate("2022-05-17T08:14:15.656Z"),

shipping: { customer: "Kartik", address: "Longroad 1343", city: "Peterburg", region: "", state: "PE", country: "Peteonia", delivery_notes: "Leave at the gate"},

tracking: { company: "ups", tracking_number: "22122X211SD", status: "ontruck", estimated_delivery: new ISODate("2012-05-17T08:14:15.656Z") },

payment: { method: "visa", transaction_id: "2312213312XXXTD" },

products: {quantity: 2, sku:"111445GB3", title: "Simsong mobile phone", unit_cost:1000, currency:"USDA"} } ])

All Queries: db.customer.aggregate([{$group : {_id : "$price", Avg : {$avg : $price}}}])

db.order.aggregate ([{$group : {_id : $order, sum : {$sum : $order} }}])

db.customer.aggregate ([$group : {_id: $city}])

db.customer.aggregate ([$match : {city : "Mumbai"}])

 
 
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.