Chat.js 490 Bytes
Newer Older
Choi Ga Young's avatar
xxxxxx    
Choi Ga Young committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
import mongoose from 'mongoose'

const {String} = mongoose.Schema.Types

const ChatSchema = new mongoose.Schema({
    room: {
        type: ObjectId,
        required: true,
        ref:'Room',
    },
    nickname: {
        type: String,
        required: true,
        ref:'USer',
    },
    chat: String,
},{
    timestamps: true
})

export default mongoose.models.Chat || mongoose.model('Chat', ChatSchema)
//chat라는 이름이 있으면 앞을 return하고 없으면 뒤를 실행함