title: Error while saving in MongoDB
body: <p>I am getting forllowing error when I try to save data in to MngoDB. <code>Error [ERR_HTTP_HEADERS_SENT]: Cannot set headers after they are sent to the client at ServerResponse.setHeader (_http_outgoing.js:481:11)</code>
  It was working fine, I do not know from where this error came from! I have tried to install and unistall jest, as suggested, not useful.
  here is when the error happens:</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>            dataTrattamenti.save((error) =&gt; {
  
                  if (error) {
                     
                      res.send({success: false, message: 'We cannot save the data, there is an error: ', error})
                  } else
                    
                  res.send({success: true, message: 'Successfully saved'})
              });</code></pre>
  </div>
  </div>
  
  if I write </p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>   res.end({success: true, message: 'Successfully saved'})</code></pre>
  </div>
  </div>
  </p>
  
  <p>as suggested by some, i am not getting any error in Node but in what it send is </p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code> 'We cannot save the data, there is an error:</code></pre>
  </div>
  </div>
  </p>
  
  <p>while error variable seems to be empty.
  I tryied the code with postman, it works fine. please help, I have no clue what is going on. what is the header the error is talking about?</p>