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하고 없으면 뒤를 실행함