QuXiangjie / Property-management-MERN

www.estate.100jsprojects.com/
0 stars 0 forks source link

Create User Model #7

Open QuXiangjie opened 7 months ago

QuXiangjie commented 7 months ago

Create user model

in the api-create a models folder inside the model folder, create -user.model.js inside this file


 import mongoose from 'mongoose'
const userSchema=new mongoose.Schema(
{
username:{
type: String,
required: true,
unique: true,
},
email:{
type: String,
required: true,
unique: true,
},
password:{
type: String,
required: true,
unique: false,  ---two customers can have the same password
},

}
,{timestamps:true});

const User=mongoose.model('User',userSchema)
export default User