survey.model.ts 378 Bytes
Newer Older
Jiwon Yoon's avatar
Jiwon Yoon committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
import { model, Schema, Types } from "mongoose";

export interface ISurvey {
    title: string;
    comment: string;
    questions: Types.ObjectId[]
  }
  
  const schema = new Schema<ISurvey>({
    title: {type:String},
    comment: {type:String},
    questions: [{ type: Schema.Types.ObjectId, ref: 'Question' }],
  });
  
  export default model<ISurvey>("Survey", schema);