I have tried this, which allows null, undefined, and complete omission of the key to be saved:
{
  myField: {
    type: String,
    validate: value => typeof value === 'string',
  },
}
and this, which does not allow '' (the empty string) to  be saved:
{
  myField: {
    type: String,
    required: true,
  },
}
How do I enforce that a field is a String and present and neither null nor undefined in Mongoose without disallowing the empty string?
 
     
     
     
    