UNPKG

flexbiz-server

Version:

Flexible Server

4 lines (3 loc) 1.13 kB
'use strict';const eventsSchema=new Schema({id_app:{type:String,required:!0,maxlength:1024},title:{type:String,required:!0,maxlength:1024},content:{type:String},address:{type:String,maxlength:1024},location:Schema.Types.Mixed,date_from:{type:Date,required:!0},date_to:{type:Date,required:!0},price:{type:Number,default:0},picture:{type:String,maxlength:1024},other_pictures:[String],exfields:Schema.Types.Mixed,newsfeed:{type:Boolean,default:!0},status:{type:Boolean,default:!0},date_created:{type:Date, default:Date.now},date_updated:{type:Date,default:Date.now},user_created:{type:String,default:""},user_updated:{type:String,default:""}});(global.configs||{}).createIndexes&&(eventsSchema.index({id_app:1,date_from:1,date_to:1}),eventsSchema.index({date_updated:-1}),eventsSchema.index({date_created:-1}),eventsSchema.index({user_created:1}),eventsSchema.index({title:1}),eventsSchema.index({content:1}),eventsSchema.index({address:1}),eventsSchema.index({title:"text",content:"text",address:"text"}),eventsSchema.index({status:1})); const model=mongoose.models.events||mongoose.model("events",eventsSchema);module.exports=model;