DEV Community

Discussion on: designing database

Collapse
 
anshulnegitc profile image
Anshul Negi

This is how I have designed Model

const userSchema = mongoose.Schema({
email: { type: String, require: true },
address: { type: String, require: true },
role:{ type: String, require: true },
password:{ type: String, require: true },
extraInformation: {
firstname: { type: String, minlength: 1, maxlength: 255, require: true },
lastname: { type: String, minlength: 1, maxlength: 255, require: true },
sales : {
attachments: { type: String, minlength: 1, maxlength: 255, require: true },
experience: { type: String, require: true, minlength: 1, maxlength: 255 },
education: { type: String, require: true, minlength: 1, maxlength: 255 },
}
},
marketting: {
teamName: { type: String, minlength: 1, maxlength: 255 },
members: { type: String, minlength: 1, maxlength: 255, require: true },
attachments: { type: String, minlength: 1, maxlength: 255 },
}
});