Q:

Can i set required property in MongoDB to multi language

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"
  }
});

A:

const validationMessagesTranslation = (field, lang) => {
  const validationMessages = {
    "en": {
      name: "Name is required",
      surname: "Surname is required"
    },
    "fr": {
      name: "Le nom est requis.",
      surname: "Le nom de famille est requis."
    }
  }
  return validationMessages[lang][field];
}

You can create a function that holds an enum with all translations that you need.Pass that function to the required value of your models.

