The CartItem schema

The CartItem schema will represent each product ordered. It will contain a reference to the product, the quantity of the product ordered by the user, a reference to the shop the product belongs to, and a status.

mern-marketplace/server/models/order.model.js:

const CartItemSchema = new mongoose.Schema({  product: {type: mongoose.Schema.ObjectId, ref: 'Product'},  quantity: Number,  shop: {type: mongoose.Schema.ObjectId, ref: 'Shop'},  status: {type: String,    default: 'Not processed',    enum: ['Not processed' , 'Processing', 'Shipped', 'Delivered',    'Cancelled']}}) const CartItem = mongoose.model('CartItem', CartItemSchema)

The status of the product can only have the values as defined in the enums, representing the current state ...

Get Full-Stack React Projects now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.