假设我有一个像这样的Mongoose Schema:
import { Schema, Document, model } from 'mongoose';
let MySchema = new Schema({
name: {
type: String,
required: true,
maxlength: [200, 'Must be {MAXLENGTH} characers or less.']
}
}, { collection: 'mystuff' });
const MyModel = model('MyStuff', MySchema);
export { MyModel };
我可以通过maxlength
检查name
属性MyModel
上的内容吗?