Answers for "mongoose either required"

1

email validation in mongoose

import { isEmail } from 'validator';
// ... 

const EmailSchema = new Schema({
    email: { 
        //... other setup
        validate: [ isEmail, 'invalid email' ]
    }
});
Posted by: Guest on August-25-2020

Browse Popular Code Answers by Language