Preview:
var validator = require('validator');

tea_email: {
            type: String,
            required: true,
            unique: true,
            lowercase: true,
            // validate: [validator.isEmail, 'Please enter a valid email']
            validate(value){
                if(!validator.isEmail(value)){
                    throw new Error('Please enter a valid email');
                }
            }
        },
downloadDownload PNG downloadDownload JPEG downloadDownload SVG

Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!

Click to optimize width for Twitter