Connection Nodejs to Mongodb in Droplet

August 7, 2017 125 views
Node.js MongoDB Ubuntu 16.04

I created two droplets, deployed my Nodejs backed in first one, installed Mongodb in the second one. I also secured the MongoDB with database admin user, and a SSH key login to the MongoDB Droplet. Now I am stuck, I don't know how to connect my Nodejs app to MongoDB Database. How will I connect to the database? Using a Connection String? or by attaching and sending an object with all port values, ssh key etc? I am not sure how to get it done, any help will be highly appreciated. Thank you.

Be the first one to answer this question.