@mikro-orm/mongodb 6.3.10 → 6.3.11-dev.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -91,10 +91,12 @@ class MongoSchemaGenerator extends core_1.AbstractSchemaGenerator {
91
91
  if (res.some(r => r.status === 'rejected') && options.retry !== false) {
92
92
  const skipIndexes = [];
93
93
  const collectionsWithFailedIndexes = [];
94
+ const errors = [];
94
95
  for (let i = 0; i < res.length; i++) {
95
96
  const r = res[i];
96
97
  if (r.status === 'rejected') {
97
98
  collectionsWithFailedIndexes.push(promises[i][0]);
99
+ errors.push(r.reason);
98
100
  }
99
101
  else {
100
102
  skipIndexes.push({ collection: promises[i][0], indexName: r.value });
@@ -102,7 +104,9 @@ class MongoSchemaGenerator extends core_1.AbstractSchemaGenerator {
102
104
  }
103
105
  await this.dropIndexes({ skipIndexes, collectionsWithFailedIndexes });
104
106
  if (options.retryLimit === 0) {
105
- throw new Error(`Failed to create indexes: ${collectionsWithFailedIndexes.join(', ')}`);
107
+ const details = errors.map(e => e.message).join('\n');
108
+ const message = `Failed to create indexes on the following collections: ${collectionsWithFailedIndexes.join(', ')}\n${details}`;
109
+ throw new Error(message, { cause: errors });
106
110
  }
107
111
  await this.ensureIndexes({
108
112
  retry: collectionsWithFailedIndexes,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mikro-orm/mongodb",
3
- "version": "6.3.10",
3
+ "version": "6.3.11-dev.1",
4
4
  "description": "TypeScript ORM for Node.js based on Data Mapper, Unit of Work and Identity Map patterns. Supports MongoDB, MySQL, PostgreSQL and SQLite databases as well as usage with vanilla JavaScript.",
5
5
  "main": "index.js",
6
6
  "module": "index.mjs",
@@ -65,6 +65,6 @@
65
65
  "@mikro-orm/core": "^6.3.10"
66
66
  },
67
67
  "peerDependencies": {
68
- "@mikro-orm/core": "^6.0.0"
68
+ "@mikro-orm/core": "6.3.11-dev.1"
69
69
  }
70
70
  }