Skip to content

Commit

Permalink
Merge pull request seanemmer#31 from ofallante/master
Browse files Browse the repository at this point in the history
Fixed depreciated mongoose functions
  • Loading branch information
seanemmer authored Feb 24, 2019
2 parents 75cff83 + 60f7b83 commit 9dc7dd0
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,10 @@ Seeder.prototype.connect = function(...params) {
console.error('Pass either 2 or 3 arguments to seeder.connect');
process.exit(1);
}


mongoose.set("useCreateIndex", true);
mongoose.set("useNewUrlParser", true);

if (mongoose.connection.readyState === 1) {
_this.connected = true;
consoleLog(_this, 'Successfully initialized mongoose-seed');
Expand Down Expand Up @@ -133,7 +136,7 @@ Seeder.prototype.clearModels = function(models, cb) {
// Clear each model
async.each(modelNames, function(modelName, done) {
var Model = mongoose.model(modelName);
Model.remove({}, function(err) {
Model.deleteMany({}, function(err) {
if (err) {
console.error(chalk.red('Error: ' + err.message));
return;
Expand Down

0 comments on commit 9dc7dd0

Please sign in to comment.