const { Schema, model } = require('mongoose') const schema = new Schema({ name: {type: String, required: true}, phone: {type: String, required: true,unique: true,}, created: { type: Date, default: () => new Date().toISOString(), }, }) schema.set('toJSON', { virtuals: true, versionKey: false, }) schema.virtual('id').get(function () { return this._id.toHexString() }) exports.MasterModel = model('dry-wash-master', schema)