Project 2
1) db.create.customer("_id":61664651,"name":pratap,"gender":M,"dob":29/2/1980,"age":30,"city":"bang","member":"permium");
db.create.seller("_id":51646516,"name":pratap,"gender":M,"dob":29/2/1980,"age":30,"city":"bang","member":"permium");
db.products.insert({
sku: "111445GB3",
title: "mobile phone",
manufacture_details: {
model_number: "oneplus9",},
shipping_details: {
weight: 170,
width: 3,
height:6.5},
quantity:1,
pricing: {
price: 60000}});
db.products.find({categories: /^mobile/})
db.categories.insert({title: "Mobiles with 5G", parent: "mobile", path: "mobile/fm"})
db.categories.insert({title: "pants in jeans", parent: "pants", path: "pants/jeans"});
db.cart.insert({
product_id: 4646464,
status:'added',
quantity: 1,
total: 60000,
products: []});
db.orders.insert({
customerId: "32164",
paymentmethod: "gpay",
paymentStatus: "paid",
status: "shippedAwaitingDelivery",
currency: "rupee",
totalCost: NumberDecimal(39.85});
Simple Queries of ecommerce db
1)db.customer.find({ "_id": 1, "avg_order":0-10});
2)db.customer.find()sort({"months":2,id.0});
3)db.customer.sum({"month":"total orders"});
4)db.customer.find({"city":.*}).count();
5)db.customer.find().sort({"seller":*}).sort({"city":-1});