From 81306585834150ccaa0107fe6291f68278978db9 Mon Sep 17 00:00:00 2001 From: Drew Gross Date: Wed, 15 Jun 2016 15:01:21 -0700 Subject: [PATCH] Fix purge --- src/Adapters/Storage/Mongo/MongoStorageAdapter.js | 2 +- src/Controllers/DatabaseController.js | 8 ++------ 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/src/Adapters/Storage/Mongo/MongoStorageAdapter.js b/src/Adapters/Storage/Mongo/MongoStorageAdapter.js index 6082952f..b24ed6b9 100644 --- a/src/Adapters/Storage/Mongo/MongoStorageAdapter.js +++ b/src/Adapters/Storage/Mongo/MongoStorageAdapter.js @@ -201,7 +201,7 @@ export class MongoStorageAdapter { // undefined as the reason. getClass(className) { return this._schemaCollection() - .then(schemasCollection => schemasCollection._fechOneSchemaFrom_SCHEMA(className)); + .then(schemasCollection => schemasCollection._fechOneSchemaFrom_SCHEMA(className)) } // TODO: As yet not particularly well specified. Creates an object. Maybe shouldn't even need the schema, diff --git a/src/Controllers/DatabaseController.js b/src/Controllers/DatabaseController.js index 65bea913..9e3c6e38 100644 --- a/src/Controllers/DatabaseController.js +++ b/src/Controllers/DatabaseController.js @@ -100,12 +100,8 @@ DatabaseController.prototype.collectionExists = function(className) { DatabaseController.prototype.purgeCollection = function(className) { return this.loadSchema() - .then((schema) => { - schema.getOneSchema(className) - }) - .then((schema) => { - this.adapter.deleteObjectsByQuery(className, {}, schema); - }); + .then(schemaController => schemaController.getOneSchema(className)) + .then(schema => this.adapter.deleteObjectsByQuery(className, schema, {})); }; DatabaseController.prototype.validateClassName = function(className) {