forked from bro-students/multy-stub
21 lines
463 B
JavaScript
21 lines
463 B
JavaScript
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)
|