javascript - Are there any Mongoose validation libraries? -


I am new to mongoDB and mongoose. In fact, I'm completely new to JavaScript. As a result, I am not sure that I How to sanitize your data.

I was wondering if there is a library with custom verification work which takes care of at least a few common threats, for which one should look. Apart from this, it would be good if it was already using verification like email, or character length.

There are several libraries for Hi Mongoose schema verification. Some are listed below.

There are good libraries for both validity. In addition to this Mangoi provides custom logic for verification.

And more if you want to create custom logic,

  const emailRegex = / ^ \ w + ([\ .-]? \ W + ) * @ \ w + ([\. -]? \ W *) * (\. \ W {2,3}) + $ / email: {type: string, trim: true, unique: true, required: ' Email address is required ', validate: {validator: (email) = & gt; {Return emailRegex.test (email)}, Message: '{VALUE} is not a valid email'}, mail: [emailRegex, 'Please fill in a valid email address']}    

Comments

Popular posts from this blog

php - PDO bindParam() fatal error -

logging - How can I log both the Request.InputStream and Response.OutputStream traffic in my ASP.NET MVC3 Application for specific Actions? -

java - Why my included JSP file won't get processed correctly? -