fiware-orion
fiware-orion copied to clipboard
mongodriver follow up: -mongoUri CLI parameter
Modern mongo drivers use mongo URI (i.e. mongo://...
) as a connection string to connect to MongoDB servers. It would be very beneficial (and pretty easy) to implement this in Orion, in a new parameter -mongoUri
(checking that is not used at the same time than other parameters currently used to compose the URL, e.g. -dbhost
are not used at the same time).
This would allow overcoming limitations in the current connection mode (we don't support every possible connection parameter in CLI parameters and adding more parameters would not be a scalable solution).
The preferred conection mode would be -mongoUri
and the following CLI flags would be deprecated (a WARN message will be printed if some of them is used):
- dbhost
- rplSet
- dbuser
- dbpwd
- dbAuthMech
- dbAuthDb
- dbSSL
- dbTimeout
Solving this issue also will solve the limitation currently described in cli.md with regards to -dbSSL
switch:
Note there is currently a limitation: Orion uses
tlsAllowInvalidCertificates=true
in this case, so the certificate used by MongoDB server is not being validated.
This SOF question would need modification upon completion of this issue: https://stackoverflow.com/questions/69932011/orion-contextbroker-allows-set-read-preference-to-mongodb-replicaset/69944749#69944749
This another SOF question would need modification upon completion of this issue: https://stackoverflow.com/questions/70186342/fiware-orion-with-atlas-mongodb
Hey there, I just wanted to check if you guys plan on working on this soon :) I'm also interested in setting the read preference.
Hey there, I just wanted to check if you guys plan on working on this soon :) I'm also interested in setting the read preference.
Not at the present moment, but maybe you (or any other in the community with this need) want to work on it. It is not a difficult implementation and we could provide some feedback on it, along with pull request review, of course.
Thanks in advance to any brave volunteer! :)
Hello, I would like to know if anyone was successful in fixing this problem otherwise I might try to do it for my project. Thank you in advance
As far as I know, nobody is working on this, so feel free on taking the issue :)
Thanks for your willingness to contribute!
I already implemented this for Orion-LD, some time ago. I called the CLI param "-dbURI' as it is no longer only mongo in the game (DocumentDB, CosmosDB, ...) You can borrow from there if you want to: https://github.com/FIWARE/context.Orion-LD/blob/develop/src/lib/orionld/mongoc/mongocInit.cpp#L130
Especially, I got the request to have the password separate, not in the same CLI as the rest, so I implemented a replace functionality for the resulting URI - that's something you might want to keep in mind, using my implementation or not.
Thank you very much, I will try to do this this week and I will make sure to mention you in the PR._
PR #4385