设置vitual属性
personSchema.virtual('name.full').get(function () { return this.name.first + ' ' + this.name.last; });获取vitual属性,两种方式获取:1.doc._doc.full获取
personSchema.virtual('name.full').get(function () { return this.name.first + ' ' + this.name.last; });
full
2.doc.toObject({virtuals: true}) 格式化后获取
virtuals: true}