This is how I would normally add a virtual field to a schema:
const mySchema = new Schema({ ... }); mySchema.virtual(\'myVirtualField\').get(function () { re