title: How to avoid TypeError: callback.apply is not a function and Callback was already called ? node js
body: <p>I got   ++TypeError: callback.apply is not a function
  and    ++Callback was already called.</p>
  
  <p>this is my code:</p>
  
  <pre><code>var toFix = {
      'Mercedes': 'Mercedes-Benz'
    };
  
    var toUpdate = {
      'A-CLASSE': 'Classe A',
      'CLASSE A': 'Classe A',
    };
  
    async.series([
  
      function (cb) {
        console.log('Clean cars...');
  
        async.forEachOfSeries(toFix, function (to, from, cb) {
          console.log(`FixMakeForCars ${from} -&gt; ${to}`);
          Car.update({'make': {$regex: S(from).trim().s, $options: 'i'}}, {$set: {'make': to}}, {multi: true}, cb);
  
        }, cb);
  
        async.forEachOfSeries(toUpdate, function (to, from, cb) {
          console.log(`UpdateModelForCars ${from} -&gt; ${to}`);
          Car.update({'model': {$regex: S(from).trim().s, $options: 'i'}}, {$set: {'model': to}}, {multi: true}, cb);
  
        }, cb);
  
      },
  
  
      function (cb) {
        console.log('Clean car models...');
  
        async.forEachOfSeries(toFix, function (to, from, cb) {
          console.log(`FixCarModelMake ${from} -&gt; ${to}`);
          CarModel.update(
            {'make': {$exists: true}}, {'model': {$exists: true}}, {'year': {$exists: true}},
            {'make': {$regex: S(from).trim().s, $options: 'i'}}, {$set: {'make': to}}, {multi: true}, cb);
        }, cb);
  
          async.forEachOfSeries(toUpdate, function (to, from, cb) {
            console.log(`UpdateModel ${from} -&gt; ${to}`);
            CarModel.update(
              {'make':{ $exists: true}}, {'model':{ $exists: true}}, {'year':{ $exists: true}},
              {'car.model': {$regex: S(from).trim().s, $options: 'i'}}, {$set: {'car.model': to}}, {multi: true}, cb);
          }, cb);
      },
  
  
    ], function () {}
    );
  
  };
  </code></pre>
  
  <p>this is carModel schema.</p>
  
  <pre><code>var schema = new mongoose.Schema({
    make: {type: String, trim: true, required: true},
    model: {type: String, trim: true, required: true},
    year: {type: Number},
    enabled: {type: Boolean, default: false},
    range: {type: String, enum: _.values(Range)},
    premium: {type: Boolean, default: false},
    picture: {},
    status: {type: String, enum: _.values(CarModelStatus), default: CarModelStatus.DRAFT}
  });
  
  schema.index({model: 1, make: 1, year: 1}, {unique: true});
  </code></pre>
  
  <p>What should I do please?</p>
  
  <p>and this the error in terminal:</p>
  
  <p>[</p>
  
  <pre><code>2017-03-31T12:29:15.219Z] DEBUG: job/306 on f2a8df0485ee: FixCarModelMake Mercedes -&gt; Mercedes-Benz (env=development)
      caller: {
        "line": "269",
        "pos": "17",
        "file": "job/apply-updates/3.8.1-update-to-Mercedes-Benz.js"
      }
  [2017-03-31T12:29:15.237Z] ERROR: job/306 on f2a8df0485ee: (env=development)
      TypeError: callback.apply is not a function
          at /sources/node_modules/mongoose/lib/model.js:3411:16
  </code></pre>
  
  <p>thanks for helping me.</p>