Mongodb – How will I validate the mobile number in mongoose
import mongoose from "mongoose"; const mobileNoSchema = mongoose.Schema( mobileNo: { type: String, // min: [10, "no is < 10"], // max: [10, "no is > 10"], validate: { validator: function(v) { if(v.length === 10) return true; return /d{10}/.test(v); }, message:…