You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
when using Mongodb with mikroorm it does not recreate indexes and there seems to be no other way to drop indexes.
We are using this.orm.getSchemaGenerator().ensureIndexes(); this only complaints about index definition mismatches, there is no way to simply drop indexes and recreate them in such cases. If an orm can create indexes it should also care about their upgrade path
There is also no way to gather information from the resulting error since it basically pushed the mongodb error to the user without treating it accordingly (api leakage)
Stack trace
MongoServerError: Index with name: ldapDn_1 already exists with different options
at MessageStream.messageHandler (/home/zarathustra/code/schulcloud-server/node_modules/mongodb/src/cmap/connection.ts:753:20)
at MessageStream.emit (node:events:390:28)
at processIncomingData (/home/zarathustra/code/schulcloud-server/node_modules/mongodb/src/cmap/message_stream.ts:168:12)
at MessageStream._write (/home/zarathustra/code/schulcloud-server/node_modules/mongodb/src/cmap/message_stream.ts:65:5)
at writeOrBuffer (node:internal/streams/writable:389:12)
at _write (node:internal/streams/writable:330:10)
at MessageStream.Writable.write (node:internal/streams/writable:334:10)
at Socket.ondata (node:internal/streams/readable:754:22)
at Socket.emit (node:events:390:28)
at addChunk (node:internal/streams/readable:315:12) {
ok: 0,
code: 85,
codeName: 'IndexOptionsConflict'
}
To Reproduce
Steps to reproduce the behavior:
define an entity with any kind of index
let mikroorm create indexes
change an existing index definition in an entity (nullable false -> nullable true for example)
rerun {{ensureIndexes}} - exception occurs
Expected behavior
Indexes get recreated with an warning, most probably with another option to enable this feature
@totalard the problem is not with ensuring indexes, but that we only care about creating new indexes, not removing old indexes nor changing redefined ones.
Describe the bug
when using Mongodb with mikroorm it does not recreate indexes and there seems to be no other way to drop indexes.
We are using
this.orm.getSchemaGenerator().ensureIndexes();
this only complaints about index definition mismatches, there is no way to simply drop indexes and recreate them in such cases.If an orm can create indexes it should also care about their upgrade path
There is also no way to gather information from the resulting error since it basically pushed the mongodb error to the user without treating it accordingly (api leakage)
Stack trace
To Reproduce
Steps to reproduce the behavior:
Expected behavior
Indexes get recreated with an warning, most probably with another option to enable this feature
Versions
| Dependency | Version |
| node | v16.13.1 |
| typescript | 4.2.4 |
| mikro-orm | 5.0.5 |
| your-driver | mongodb |
The text was updated successfully, but these errors were encountered: