const mongoose = require('mongoose'); const mongoosePaginate = require('mongoose-paginate-v2'); const PollSchema = mongoose.Schema({ title: String, description : {type : String , default : null}, surveyType : {type : String , default : 'check'}, catId: {type: mongoose.Schema.Types.ObjectId, ref: 'Category'}, allCat: [{type: mongoose.Schema.Types.ObjectId, ref: 'Category'}], rootParent: {type: mongoose.Schema.Types.ObjectId, ref: 'Category'}, // index: {type: Number, default: null}, options : {type : Array , default : []}, answers : {type : Array , default : []}, userIds : {type : Array , default : []}, startDate : Date, endDate : Date, publish: {type: Boolean, default: false}, _creator :{type: mongoose.Schema.Types.ObjectId, ref: 'User'}, _updatedBy: {type: mongoose.Schema.Types.ObjectId, ref: 'User'}, }); PollSchema.plugin(mongoosePaginate); module.exports = mongoose.model('Poll', PollSchema);