const mongoose = require('mongoose'); const Schema = mongoose.Schema; const collectionName = 'infoPriceClass'; const modelSchema = { ID: { type: String, required: true, index: true }, class: { type: Number, unique: true, index: true }, // 类别 classCode: String, // 别名编码 code: String, // 编码 name: String, // 材料名称 specs: String, // 规格型号 unit: String, // 单位 }; mongoose.model(collectionName, new Schema(modelSchema, { versionKey: false, collection: collectionName }));