-
Notifications
You must be signed in to change notification settings - Fork 20
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
can't connect to mongodb atlas (mongodb hosted on aws, with mongodb+srv://
uri)
#87
Comments
mongodb+srv://
uri)
Two challenges, at least the last time I checked: I don't believe SRV lookups work yet, so you will need to connect to a single server in the cluster. Also, unless you have a high end account, Atlas forces you to SCRAM256 auth (rather than standard SCRAM1). That is a quasi unique change to force smaller users to Compass, their commercial client. Any hosting provider other than Atlas will give you SCRAM1. Myself, I switched to ScaleGrid. But, my knowledge is six months old, so take it with a grain of salt. On a different project, I've been experimenting with cluster support (at least with explicit references.) Your question makes me wonder if someone has solved SRV in Nim. I might ask the forum tonight. |
thanks for your quick reply!
but then using that uri fails with nimongo with:
so I guess this is because of your point regarding SCRAM256 vs SCRAM1 ? just trying to get anything working, happy to use whatever temporary workarounds; any idea of whether I could be using a C/C++ library and wrap that for the
I just tried on M10 (non free tier), I don't see an option for SCRAM1 ? maybe I'm missing something? linksEDIT: see https://github.com/ba0f3/scram.nim which mentions: Salted Challenge Response Authentication Mechanism (SCRAM-SHA-1 SCRAM-SHA-256 SCRAM-SHA-512) |
Wow, @ba0f3 is supporting SCRAM-SHA-256 now. Thanks for the update on that. I'll have to add SCRAM-256 to my fork at The error you are seeing looks very familiar as my fork was giving the same errors. Apparently as Nim (the language) upgraded to newer versions, the internals of ba0f3's SHA and SCRAM libraries also had to change. ba0f3 was very useful in helping me fix my fork (mine is for pooled connections to the connections). If I get time this weekend, I'll see if I can fix nimongo also. |
As to Atlas, I just jumped to my account also. I don't see it either. It used to be a user setting under "Database Access" for the cluster. But it appears to be unchangeable now. There might be some secret setting somewhere that Mongodb.com tech support can find. |
(BTW, I created the fork as I was wanting to use it on a web server and adding pooling fundamentally changed the nature of the library IMO.) Nimongo is very fast, faster than mongopool. But mongopool safely lives inside Jester threads and shares an existing preconnected pool. This is important since SCRAM1 can take 3 or 4 seconds to authenticate. I learned this the hard way when I discovered it took 3 seconds to bring up a web page 😃 without pooling. |
I will add SRV support to my dnsclient package |
the authentication logic is very complex (and many things are not supported in nimongo, eg see authentication options in mongo-c-driver/src/libmongoc/doc/authentication.rst, eg the newer Wouldn't it be much simpler if nimongo would wrap libmongoc instead of re-inventing the wheel here, at least for things like authentication? |
For most programming languages, the available libraries for MongoDB are simply thin wrappers of the C But yes, a wrapper of (off-topic: This reminds me: now that I've written a binary-compatible Decimal128 library for Nim, I need to add it to the BSON to finish out the spec. The only remaining types missing are the deprecated and almost-deprecated ones such as DBPointer.) |
an ideal mongo library for me would wrap libmongoc for most things and provide a friendly high level wrapper around it. But https://github.com/nim-lang/mongo unfortunately is described as "unsuable" in the readme... |
@JohnAD does https://github.com/mashingan/anonimongo fit your requirement? eg you can do: (in the spirit of having 1 feature complete library as opposed to many that all have missing key features) |
@SSPkrolik
I can't connect to mongodb atlas (mongodb hosted on aws)
Steps to reproduce the behavior:
returns nil, and on inspection (modifying
proc connect*(m: Mongo): bool =
to avoid try/except), it fails in:m.host resolves to:
mongoatlasxxx.yyy.mongodb.net
so the
mongodb+srv://
is lost; and I'm not sure how to instrument the code to use that ; naive attempts failed.Expected behavior
works
Desktop (please complete the following information):
note + links
see https://developer.mongodb.com/article/srv-connection-strings
having TITLE: nimongo and MongoDb.Atlas connection - Nim forum
The text was updated successfully, but these errors were encountered: