Details
-
Improvement
-
Resolution: Works as Designed
-
Minor - P4
-
None
-
None
-
None
-
Empty show more show less
Description
Hello,
This issue is about the native mongo driver for node.js
It's not possible to open issues on the github repository, so I'm oppenning it here.
I realized that you are shallow cloning the options passed to the connect method (and in some other random places).
I think that is very unlikely that someone expects their options object to not be mutated. Usually I just provide the options object to the connect method and forget about it.
My problem with shallow cloning is that I'm using getters on my options object, so I can defer certificates reading until it is needed , if it's even needed because there are many cases where not. This allows me to use the same object shape for both connections secured with SSL and connections that are not.
But because you are shallow cloning the object you are accessing all the properties and hence execute all the getters.
Here is my problematic line of the driver:
https://github.com/mongodb/node-mongodb-native/blob/9dc5bbcc2235cf9a433345e2a9d9bf0ff72208dc/lib/authenticate.js#L76
Regards