title: NodeJS TypeError: Model is not a constructor
body: <p>I have an Angular5 app that is making requests to my NodeJS Api, specifically I'm trying to do a <code>put</code> request. The first time it works fine, but on the second time I call it, it says that my Model is not a constructor. I'm using Mongoose in NodeJS.</p>
  
  <p>Here is the piece of code in NodeJS:</p>
  
  <pre><code>var Aviamentos = require('./../models/Aviamentos');
  router.put('/:receitaId/prescricoes/:prescricaoId/aviar', function (req, res) {
      let aviamento = new Aviamentos({ // &lt;-- It fails on this line the second time
          Farmaceutico: req.body.Farmaceutico,
          Data: new Date(),
          Quantidade: req.body.Quantidade,
      });
      ...
  </code></pre>
  
  <p>Here is my Model:</p>
  
  <pre><code>var mongoose = require('mongoose');
  var Schema = mongoose.Schema;
  
  var aviamentoSchema = mongoose.Schema({
      Farmaceutico: {
          type: mongoose.Schema.Types.ObjectId,
              ref: 'User'
      },
      Data: Date,
      Quantidade: Number
  });
  
  module.exports = mongoose.model( 'Aviamentos', aviamentoSchema);
  </code></pre>
  
  <p>The first time I execute the request on the AngularJS side, it works fine, but the second time I get this erro: <code>TypeError: Aviamentos is not a constructor</code></p>
  
  <p>Here is my function in Angular5:</p>
  
  <pre><code>aviarPrescricao(idReceita: string, idPrescricao: string, Quantidade: number){
      let headers = new Headers();
      headers.append('Content-Type', 'application/json');
      let body = {
          Quantidade: Quantidade,
          Farmaceutico: '5a08540a243ad41cf0659376'
      };
      return this.http.put(this.baseURL + '/' + idReceita + '/prescricoes/' + idPrescricao + '/aviar', JSON.stringify(body), { headers: headers })
          .map((response: Response) =&gt; response.json());
  }
  </code></pre>