Skip to content

Commit 53a62f2

Browse files
committed
Verifying class exists before pulling indexes
1 parent 5897035 commit 53a62f2

File tree

2 files changed

+9
-8
lines changed

2 files changed

+9
-8
lines changed

src/Adapters/Storage/Mongo/MongoStorageAdapter.js

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -570,14 +570,16 @@ export class MongoStorageAdapter {
570570
.then((classes) => {
571571

572572
// map out promises from individual classes
573-
const promises = classes.map(() => { // schema
574-
575-
/* eslint-disable no-console */
576-
console.info(`>>>>>> Preparing for ` + schema.className);
577-
/* eslint-enable no-console */
573+
const promises = classes.map((schema) => {
574+
if(!this.classExists(schema)) {
575+
/* eslint-disable no-console */
576+
console.info(`>>>>>> Skipping ` + schema.className);
577+
/* eslint-enable no-console */
578+
return;
579+
}
578580

579581
// get indexes for this given collection
580-
return this.getIndexes(schema.className).then(() => { // indexes
582+
return this.getIndexes(schema.className).then((indexes) => {
581583

582584
// reduce indexes
583585
indexes = indexes.reduce((obj, index) => {

src/Controllers/DatabaseController.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1005,8 +1005,7 @@ DatabaseController.prototype.performInitialization = function() {
10051005
throw error;
10061006
});
10071007

1008-
const indexPromise = this.loadSchema()
1009-
.then(() => this.adapter.updateSchemaWithIndexes());
1008+
const indexPromise = this.adapter.updateSchemaWithIndexes();
10101009

10111010
// Create tables for volatile classes
10121011
const adapterInit = this.adapter.performInitialization({ VolatileClassesSchemas: SchemaController.VolatileClassesSchemas });

0 commit comments

Comments
 (0)