I am making a schema for users in MongoDB and the problem that i am facing here it is that the web-app will be multi language so meaning this i am doing validation in back end more concretely in user schema, so in required field and unique i put message if something goes wrong and that message i show to the users, so if the user uses the app in different language does it is possible to change from here message and to show him.
This is the schema that i am using:
const UserSchema = new Schema({
name: {
type: String,
trim: true,
required: "Name is required"
},
surname: {
type: String,
trim: true,
required: "Surname is required"
},
username: {
type: String,
trim: true,
unique: "Username already exist",
required: "Username is required"
},
email: {
type: String,
trim: true,
unique: "Email already exists",
match: [/.+\@.+\..+/, "Please fill a valid email address"],
required: "Email is required"
},
password: {
type: String,
required: "Password is required"
},
role: {
type: String,
trim: true,
required: "Role is required"
}
});