Skip to content

Commit

Permalink
fix: depreciated mongoose functions
Browse files Browse the repository at this point in the history
  • Loading branch information
omarciovsena committed Dec 3, 2018
1 parent 75cff83 commit 60f7b83
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 60f7b83

Please sign in to comment.