schema.path方法

var sampleSchema = new Schema({ name: { type: String, required: true } });
console.log(sampleSchema.path('name'));
// 输出类似这样的信息:
/**
 * SchemaString {
 *   enumValues: [],
 *   regExp: null,
 *   path: 'name',
 *   instance: 'String',
 *   validators: ...
 */

可以用这个方法来检查给定路径模式的类型和验证器是什么

原文地址:https://www.cnblogs.com/toward-the-sun/p/6370080.html