const mongoose = require('mongoose') const ObjectID = mongoose.Schema.Types.ObjectId const categorySchema = new mongoose.Schema( { nativeName: { type: String, required: true, }, englishName: { type: String, required: true, unique: true, }, }, { toJSON: { virtuals: true }, toObject: { virtuals: true }, timestamps: true, } ) categorySchema.virtual('features', { ref: 'Feature', localField: '_id', foreignField: 'category', }) const Category = mongoose.model('Category', categorySchema) module.exports = Category