seanemmer/mongoose-seed

seeder.disconnect() is not a function

Closed this issue · 3 comments

If I follow your example:

var seeder = require('mongoose-seed');

// Connect to MongoDB via Mongoose
seeder.connect('mongodb://localhost/sample-dev', function() {

  // Load Mongoose models
  seeder.loadModels([
    'app/model1File.js',
    'app/model2File.js'
  ]);

  // Clear specified collections
  seeder.clearModels(['Model1', 'Model2'], function() {

    // Callback to populate DB once collections have been cleared
    seeder.populateModels(data, function() {
      seeder.disconnect();
    });

  });
});

I get

TypeError: seeder.disconnect is not a function

Did u forget to bump to v0.3.3 or to re-publish to npm after you added the disconnect function, as I have v0.3.2 and the disconnect function does not exist in the installed module?

Also, should

Seeder.prototype.disconnect = function disconnect() {
  mongoose.disconnect();
};

be

Seeder.prototype.disconnect = function () {
  mongoose.disconnect();
};

?

I just merged your PR and republished as 0.4.1