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
I think that this should be: return Object.assign({}, urlDriverOptions, options) in order for the implementation to match the docs. NOTE that this also seems to be the case for the other similar implementations across DriverUtils.ts
Issue 2:
When parsing the connection string, boolean values are pulled out as strings and not converted:
// create optionsObject for merge with connectionUrl object before return
optionsList.forEach((optionItem)=>{
optionKey=optionItem.split("=")[0]
optionValue=optionItem.split("=")[1]
optionsObject[optionKey]=optionValue
})
This is effectively interpreted as 'false' later on in the connection.
The combination of these two issues leads to a very hard to debug state. Which leads me on to:
Issue 3:
No type checking. There is a lot of use of any in the above code which makes these bugs harder to find - ideally the implementation would confirm type for options. For example here:
I've just hit this same issue - the url we specify gets most of its query parameters stripped out, and they are not passed to the underlying Mongo client library (or are passed as strings instead of booleans). This causes timeouts and connection closed issues when using the Mongo interface to access an Azure Cosmos DB instance.
I worked around it by patching the code at runtime to disable the URL processing logic in ormconfig.js:
It was reverted due to undefined values overwriting defined ones, but a PR to reimplement while addressing that issue would probably be accepted
As I understood the #6247 introduced a new buggy behavior ("undefined values overwriting defined ones"), while fixing the old bugs on which many people were relaying, back then (and maybe now ).
It seems not very hard to try to fix it again, anybody doing this?
As an alternative, I would suggest to change docs (delete "Please note that other data source options will override parameters set from url.").
Relevant documentation: https://orkhan.gitbook.io/typeorm/docs/connection-options#mongodb-connection-options
Relevant quote:
Issue 1:
Line of code where this seems not to be true:
typeorm/src/driver/DriverUtils.ts
Line 93 in 7cc1848
I think that this should be:
return Object.assign({}, urlDriverOptions, options)
in order for the implementation to match the docs. NOTE that this also seems to be the case for the other similar implementations across DriverUtils.tsIssue 2:
When parsing the connection string, boolean values are pulled out as strings and not converted:
typeorm/src/driver/DriverUtils.ts
Lines 236 to 241 in 7cc1848
This is effectively interpreted as 'false' later on in the connection.
The combination of these two issues leads to a very hard to debug state. Which leads me on to:
Issue 3:
No type checking. There is a lot of use of
any
in the above code which makes these bugs harder to find - ideally the implementation would confirm type for options. For example here:typeorm/src/driver/mongodb/MongoDriver.ts
Line 247 in 7cc1848
In this file, the list of options are well known, and so should the types (I believe they are listed here)
The text was updated successfully, but these errors were encountered: