Skip to content

Commit

Permalink
update: outdated npms to fix audit suggestions and deprecated method …
Browse files Browse the repository at this point in the history
…in mongoose
  • Loading branch information
s-kazuki committed Feb 1, 2019
1 parent 75cff83 commit 6c31d51
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 18 deletions.
22 changes: 12 additions & 10 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,10 @@ Seeder.prototype.connect = function(...params) {
cb = params[1];
} else if (params.length == 3) {
db = params[0];
opts = params[1];
cb = params[2];
opts = params[1];
cb = params[2];
} else {
console.error('Pass either 2 or 3 arguments to seeder.connect');
console.error('Pass either 2 or 3 arguments to seeder.connect');
process.exit(1);
}

Expand All @@ -56,14 +56,16 @@ Seeder.prototype.connect = function(...params) {
cb();
} else {
if (opts) {
mongoose.connect(db, opts, function (err) {
afterConnect(_this, err, cb);
});
opts.useNewUrlParser = true;
} else {
mongoose.connect(db, function (err) {
afterConnect(_this, err, cb);
});
opts = {
useNewUrlParser: true
};
}

mongoose.connect(db, opts, function (err) {
afterConnect(_this, err, cb);
});
}
};

Expand Down Expand Up @@ -133,7 +135,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
16 changes: 8 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"description": "Seed data population for Mongoose",
"main": "index.js",
"scripts": {
"test": "mocha test/**/*.js"
"test": "mocha --exit test/**/*.js"
},
"repository": {
"type": "git",
Expand All @@ -28,14 +28,14 @@
},
"homepage": "https://github.com/seanemmer/mongoose-seed#readme",
"dependencies": {
"async": "~1.2.0",
"chalk": "~1.0.0",
"lodash": "~4.17.10",
"path": "~0.11.14"
"async": "~2.6.1",
"chalk": "~2.4.2",
"lodash": "~4.17.11",
"path": "~0.12.7"
},
"devDependencies": {
"chai": "^3.5.0",
"mocha": "^3.0.0",
"mongoose": "^4.5.8"
"chai": "^4.2.0",
"mocha": "^5.2.0",
"mongoose": "^5.4.8"
}
}

0 comments on commit 6c31d51

Please sign in to comment.