출처: https://bumcrush.tistory.com/182 [맑음때때로 여름]
const mongoose = require('mongoose')

const userSchema = mongoose.Schema({

    name :{
        type : String,
        maxlength : 50
    },
    email : {
        type : String,
        trim : true,
        unique : 1
    },
    passworld : {
        type : String,
        minlegth : 5
    },
    lastname :{
        type : String,
        maxlength : 50
    },
    role : {
        type : Number,
        default : 0
    },
    image : String,
    token : {
        type : String
    },
    tokenExp : {
        type : Number
    }

})

const User = mongoose.model('User', userSchema)
module.exports = {User}

'DB > ETC' 카테고리의 다른 글

[GIT] git 설치  (0) 2021.02.24
[mongodb] 유저생성 및 nodejs 몽고 DB연결  (0) 2021.02.24
[mongodb] 몽고DB 클러스터 생성하기  (0) 2021.02.24

+ Recent posts