Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mongodriver follow up: -mongoUri CLI parameter #3794

Closed
fgalan opened this issue Mar 1, 2021 · 10 comments
Closed

mongodriver follow up: -mongoUri CLI parameter #3794

fgalan opened this issue Mar 1, 2021 · 10 comments

Comments

@fgalan
Copy link
Member

fgalan commented Mar 1, 2021

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
@fgalan fgalan changed the title mongodriver follow up: -mongoUri parameter mongodriver follow up: -mongoUri CLI parameter Mar 1, 2021
@fgalan
Copy link
Member Author

fgalan commented Mar 5, 2021

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.

@fgalan
Copy link
Member Author

fgalan commented Nov 12, 2021

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

@fgalan
Copy link
Member Author

fgalan commented Jan 20, 2022

This another SOF question would need modification upon completion of this issue: https://stackoverflow.com/questions/70186342/fiware-orion-with-atlas-mongodb

@SBlechmann
Copy link

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.

@fgalan
Copy link
Member Author

fgalan commented Mar 1, 2022

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! :)

@eduardoCarneiro99
Copy link

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

@fgalan
Copy link
Member Author

fgalan commented Nov 28, 2022

As far as I know, nobody is working on this, so feel free on taking the issue :)

Thanks for your willingness to contribute!

@kzangeli
Copy link
Member

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.

@eduardoCarneiro99
Copy link

Thank you very much, I will try to do this this week and I will make sure to mention you in the PR._

@fgalan
Copy link
Member Author

fgalan commented Aug 9, 2023

PR #4385

@fgalan fgalan added this to the 3.11.0 milestone Aug 9, 2023
@fgalan fgalan closed this as completed Aug 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants