module.exports = mongoose => { var schema = mongoose.Schema( { status: { type: String, default: 'active' }, site: Number, create_date: { type: Date, default: Date.now }, create_by: String, update_date: { type: Date, default: Date.now }, update_by: String }, { collection: 'carousel', timestamps: true } ); schema.method("toJSON", function() { const { __v, _id, ...object } = this.toObject(); object.id = _id; return object; }); const Carousel = mongoose.model("carousel", schema); return Carousel; };