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: ...
 */

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

posted @ 2017-02-06 13:51  向着太阳生  阅读(486)  评论(0编辑  收藏  举报