From e6489b94131ebd6f31583d48f6a16cf6bcbc25ef Mon Sep 17 00:00:00 2001 From: Michael Lewkowitz Date: Fri, 15 Sep 2017 14:29:36 -0400 Subject: [PATCH] Drop collection instead of database. Prosed fix for #11 --- src/system.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/system.js b/src/system.js index 536cdea..ed25908 100644 --- a/src/system.js +++ b/src/system.js @@ -8,9 +8,10 @@ import expand from './expand'; const clean = function clean(dbName, cb) { const db = mongojs(dbName); - db.dropDatabase((err) => { + db.mongodown.drop((success) => { + const err = success ? null : 'Nothing cleaned. There was no mongodown collection in ' + dbName; db.close(); - cb(err); + cb(!success); }); }; @@ -26,7 +27,7 @@ const create = function create(dbName, cleanDb, cb) { if (cleanDb) { return clean(dbName, (err) => { if (err) { - return cb(err); + console.log(err); } return postClean(); });