Make mongoose string schema type default value as blank and make the field optional
<p>I have a test schema with mongoose in nodejs like</p>

<pre><code>testschema = mongoose.Schema({
         name:{
    type:String,
    required:true,
    unique:true
  },
  image:{
    type:String,
    required:true
  },
  category:{
    type:String
  },
});
</code></pre>

<p>How can i make the category field as optional and make it default to blank if not given by user? </p>

<p>I tried </p>

<pre><code> category:{
        type:String,
        optional: ''
      },
</code></pre>

<p>but when printing out the documents saved with the scheme it doesnt even shows the field category.</p>