Open mahendra785 opened 1 month ago
Ensure that when a new seller is registering, their name is unique. If the seller name is already taken, prevent the registration and show a message indicating that the seller name is unavailable.
Mongoose Schema Example:
const mongoose = require('mongoose');
const sellerSchema = new mongoose.Schema({
name: {
type: String,
required: true,
unique: true // Ensure the name is unique in the database
},
email: {
type: String,
required: true,
unique: true
},
// Add other fields as needed
});
const Seller = mongoose.model('Seller', sellerSchema);
module.exports = Seller;
Ensure that when a new seller is registering, their name is unique. If the seller name is already taken, prevent the registration and show a message indicating that the seller name is unavailable.