title: mongoose Create And Update _ nodejs mongoose
body: <p>my functions are working correctly now when im trying to create or updat a document with mongoose it through an error:</p>
  
  <blockquote>
    <p>Uncaught Error TypeError: Cannot set property 'undefined' of undefined
        at createCategory (/home/bell/workspace/panel-screen/controllers/CategoryController.js:21:21)
        at processTicksAndRejections (internal/process/task_queues.js:86:5)</p>
  </blockquote>
  
  <pre><code>const createCategory = async (req, res) =&gt; {
      res.setHeader('Content-Type', 'application/json');
      let err, category;
      console.log(req.body)
      [err, category] = await to(Category.create({
          name: req.body.name,
          lang: req.body.lang,
      }))
      if (err) return ReE422(res, err);
  
      return ReS(res, category)
  
  }
  
  module.exports.createCategory = createCategory;
  </code></pre>
  
  <p>I even reinstalled body parser.this is my body:</p>
  
  <pre><code>{ name: 'foo', lang: 'en' }
  </code></pre>