0% found this document useful (0 votes)
32 views11 pages

Mongo Schema Design

Uploaded by

717821e221
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
32 views11 pages

Mongo Schema Design

Uploaded by

717821e221
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 11

Backend MongoDB Design Process

List of Entity

1. User
• User ID
• Username
• Email
• Password (hashed for security)
• First Name
• Last Name
• Address (with fields for street, city, state, country, postal
code)
• Phone Number
• Profile Picture (optional)

2. Product
• Product ID
• Name
• Description
• Price
• Stock Quantity
• Category ID
• Images (array of image URLs or IDs)
• Ratings (average rating, number of ratings)
• Seller ID

3. Category
• Category ID
• Name
• Description
• Parent Category ID (for nested categories)
4. Order
• Order ID
• User ID (who placed the order)
• Order Date
• Total Amount
• Shipping Address
• Billing Address
• Order Status (e.g., pending, completed, shipped,
cancelled)
• Payment Method
• List of Products (Product ID, quantity, price)

5. Cart
• Cart ID
• User ID
• List of Products (Product ID, quantity)
• Total Price

6. Payment Details
• Payment ID
• User ID
• Card Details (number, expiry date, CVV - encrypted for
security)
• Billing Address

7. Shipping Details
• Shipping ID
• Order ID
• Carrier Information
• Tracking Number
• Estimated Delivery Date
• Status (e.g., in transit, delivered)
8. Review
• Review ID
• Product ID
• User ID
• Rating
• Comment
• Date of Review

9. Seller
• Seller ID
• Name
• Email
• Contact Information
• Address
• List of Products Sold

10. Discounts/Promotions
• Discount ID
• Description
• Discount Percentage or Amount
• Start Date
• End Date
• Applicable Products or Categories
MongoDB Schema

Users Collection
{
"_id": ObjectId,
"username": String,
"email": String,
"passwordHash": String,
"firstName": String,
"lastName": String,
"address": {
"street": String,
"city": String,
"state": String,
"country": String,
"postalCode": String
},
"phoneNumber": String,
"profilePicture": String
}
Products Collection

{
"_id": ObjectId,
"name": String,
"description": String,
"price": Decimal128,
"stockQuantity": Number,
"category": ObjectId,
"images": [String],
"ratings": {
"average": Decimal128,
"numberOfRatings": Number
},
"seller": ObjectId
}
Categories Collection
{
"_id": ObjectId,
"name": String,
"description": String,
"parentCategory": ObjectId
}

Orders Collection
{
"_id": ObjectId,
"user": ObjectId,
"orderDate": Date,
"totalAmount": Decimal128,
"shippingAddress": { ... },
"billingAddress": { ... },
"status": String,
"paymentMethod": String,
"products": [
{
"product": ObjectId,
"quantity": Number,
"price": Decimal128
}
]
}

Carts Collection
{
"_id": ObjectId,
"user": ObjectId,
"products": [
{
"product": ObjectId,
"quantity": Number
}
],
"totalPrice": Decimal128
}

PaymentDetails Collection

{
"_id": ObjectId,
"user": ObjectId,
"cardDetails": {
"number": String,
"expiryDate": Date,
"cvv": String
},
"billingAddress": { ... }
}
ShippingDetails Collection

{
"_id": ObjectId,
"order": ObjectId,
"carrier": String,
"trackingNumber": String,
"estimatedDeliveryDate": Date,
"status": String
}

Reviews Collection

{
"_id": ObjectId,
"product": ObjectId,
"user": ObjectId,
"rating": Number,
"comment": String,
"date": Date
}
Sellers Collection

{
"_id": ObjectId,
"name": String,
"email": String,
"contactInfo": String,
"address": { ... },
"productsSold": [ObjectId]
}

Discounts Collection

{
"_id": ObjectId,
"description": String,
"discountPercentage": Decimal128,
"startDate": Date,
"endDate": Date,
"applicableProducts": [ObjectId],
"applicableCategories": [ObjectId]
}
Use Cases Structure for E-commerce Application

Title: Add New Product

Description: Sellers can add new products to the online catalog.


Each product addition requires details such as name, description,
price, category, and images. Once added, the product is available
for customers to view and purchase.

Primary Actor: Seller

Preconditions: The seller must be registered and logged in.

Postconditions: The product is successfully added to the


database and is visible on the e-commerce platform.

Success Scenario:

1. The seller logs into their account.


2. They navigate to the 'Add Product' section.
3. The seller enters product details including name, description,
price, and uploads images.
4. The seller selects the appropriate category for the product.
5. The product is submitted and added to the database.
6. The product is now visible to customers on the site.

Extensions:
• The product addition fails if mandatory fields like name,
price, or category are missing.
• The process is aborted if the seller is not logged in or lacks
the necessary permissions.

Frequency of Use: Regularly, as often as sellers need to add


new products.
Priority: High

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy