const mongoose = require('mongoose'); const { Schema } = mongoose; const attachFile = new Schema({ file:{ type: String }, originalname:{ type: String }, mimetype:{ type: String }, focus_point:[{ thumbnail:{ type: String, default:"main" }, x:{ type: Number }, y:{ type: Number }, w:{ type: Number }, h:{ type: Number }, s:{ type: Number } }] }); const schema = new Schema({ title : { type: String, required: true }, description : { type: String, required: true }, link_text : { type: String, required: true }, link_url : { type: String, required: true }, news_image: attachFile, }); module.exports = mongoose.model( "news", schema );