const orders = new mongoose.Schema({
userId: String, // Reference to the user who placed the order
items: [
{
itemId: String, // Reference to the item
quantity: Number,
price: Number, // Store price at the time of the order to handle price changes
},
// ... more items
],
orderDate: Date,
status: String, // e.g., 'Processing', 'Shipped', 'Delivered', 'Canceled'
});
Users will create a new order database when they select an item to the cart and then click the checkout button.
order_details:
const orders = new mongoose.Schema({ userId: String, // Reference to the user who placed the order items: [ { itemId: String, // Reference to the item quantity: Number, price: Number, // Store price at the time of the order to handle price changes }, // ... more items ], orderDate: Date, status: String, // e.g., 'Processing', 'Shipped', 'Delivered', 'Canceled' });
Users will create a new order database when they select an item to the cart and then click the checkout button.