Skip to content

Commit 7877758

Browse files
committed
Conditionally eating failure if collection does not exist but is listed in schema
1 parent 53a62f2 commit 7877758

File tree

2 files changed

+15
-7
lines changed

2 files changed

+15
-7
lines changed

src/Adapters/Storage/Mongo/MongoStorageAdapter.js

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

572+
/* eslint-disable no-console */
573+
//console.dir(classes);
574+
/* eslint-enable no-console */
575+
572576
// map out promises from individual classes
573577
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-
}
578+
579+
/* eslint-disable no-console */
580+
//console.info(`~ ` + schema.className);
581+
/* eslint-enable no-console */
580582

581583
// get indexes for this given collection
582584
return this.getIndexes(schema.className).then((indexes) => {
@@ -593,6 +595,12 @@ export class MongoStorageAdapter {
593595
$set: { _metadata: { indexes: indexes } }
594596
}));
595597

598+
}).catch(() => { //err
599+
/* eslint-disable no-console */
600+
// silently eat the error as collection may NOT exist?
601+
//console.info(`Caught an error for ` + schema.className);
602+
//console.dir(err);
603+
/* eslint-enable no-console */
596604
});
597605
});
598606
return Promise.all(promises);

src/Controllers/DatabaseController.js

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

1008-
const indexPromise = this.adapter.updateSchemaWithIndexes();
1008+
const indexPromise = this.adapter.updateSchemaWithIndexes());
10091009

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

0 commit comments

Comments
 (0)