import mongoose from 'mongoose'; const { Schema } = mongoose; const documentSizeSchema = new Schema( { name: { type: String, required: true, unique: true, }, width: { type: Number, required: true, default: 0, }, height: { type: Number, required: true, default: 0, }, }, { timestamps: true } ); // Add virtual id getter documentSizeSchema.virtual('id').get(function () { return this._id.toHexString(); }); // Configure JSON serialization to include virtuals documentSizeSchema.set('toJSON', { virtuals: true }); export const documentSizeModel = mongoose.model('documentSize', documentSizeSchema);