I need a certificate to connect to the MongoDB Cluster. How to create it?
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.
I solved this problem. When I ran the code directly from Node Js, the connection was successful. When I ran the code from the Docker container, the mongoose did not connect.
You need to add the following dns config to docker compose:
Mongoose connection code for DigitalOcean Mongodb Cluster
Hi there,
Happy to hear that you’ve got it all working! And thank you for sharing your solution here with the community!
Hi there,
In case that you are referring to the Managed MongoDB clusters, there will be no need to generate a new SSL certificate. You will just need to make sure to use a TLS compatible MongoDB client to connect like
mongo
and specify the--tls
flag.For more information you can follow the docs here:
https://docs.digitalocean.com/products/databases/mongodb/how-to/connect/#connect-to-the-database
Let me know if you have any questions.
Best,
Bobby
I’m using mongoose to connect to a database on js node side. I can connect from my computer without problems. But when I run the code on the droplet, I always get the error:
Another important observation. When I connect from a droplet that is in Frankfurt to a base that is also in Frankfurt, I get an error. But when I connect from another droplet, which is in the Netherlands, the connection is successful
Hi there!
Thank you for the additional information! This is quite interesting, what is the exact OS version on the two Droplets?
And also does the Node.js version on the two Droplets also match?
If possible, would you mind sharing just the connection string so I could take a quick look as well?
Droplet which is in the Netherlands
Droplet which is in Frankfurt
The code is run from a docker container. Node version node:12.18.1-alpine
Connection to mongodb:
This comment has been deleted
This comment has been deleted
This comment has been deleted
This comment has been deleted
This comment has been deleted
This comment has been deleted