title: How to specify default values ​for Vue & Express & Mongo / mongoose's Date Type
body: <p>I am creating CRUD using VueJS, ExpressJS, and MongoDB.</p>
  
  <p>I have a deadline: {Type: Date, optional: true} in Mongoose, but if I do not send a deadline value to Vue's input, I get an error in Express's Create API.</p>
  
  <p>I want to generate a NULL if I do not specify a Date Value.</p>
  
  <p>How can I do it?</p>
  
  <p><strong>mongoose.js</strong></p>
  
  <pre><code>...
    deadline: {
      type: Date,
      optional: true
    },
  </code></pre>
  
  <p><strong>routes.js</strong></p>
  
  <pre><code>  let post = new Post({
      title: req.body.title,
      content: req.body.content,
      deadline: req.body.deadline,
      // If there is no deadline value, "TypeError: Can not read property 'deadline' of undefined" occurs.
    });
  </code></pre>
  
  <p><strong>Vue Form Component</strong></p>
  
  <pre><code>    create: function() {
        if (!this.todo.deadline) {
          this.todo.deadline = ''
          // not working
        }
        this.$http.post('/api/posts/create', this.post)
        .then(
          (response) =&gt; {
          ...
        })
      }
  </code></pre>