Deploy Nodejs + MongoDB on Heroku but need verify credit card when install add-on Deploy Nodejs + MongoDB on Heroku but need verify credit card when install add-on mongodb mongodb

Deploy Nodejs + MongoDB on Heroku but need verify credit card when install add-on


Setting up MongoLab manually

You dont have to use the Heroku add-on system if you dont want to. What you really want to do is to set up a MongoDB database in the cloud and get a connection string for it.

You can follow through the MongoLab documentation to guide you through this: mongoLab

In short, the steps are:

  1. Sign up for a free account
  2. Create a new database (select Single Node, Sandbox for the free tier)
  3. click on newly created DB Add a user
  4. Get the Database URI (connection string given at top)

The connection string will look something like this: mongodb://dbuser:dbpassword@ds059957.mongolab.com:59957/loc8r-dev All of the parts will be different for you of course, and you 'll have to swap out the username and password with what you specified in step 3.

Once you have your full connection string you should save it as part of your Heroku config. With a terminal prompt in the root folder of your application you can do this with the following command: $ heroku config:set MONGOLAB_URI=your_db_uri

Replace your_db_uri with your full connection string, including the mongodb:// protocol. The quick and easy way automatically creates the MONGOLAB_URI setting in your Heroku config. These manual steps bring us to the same point as the quick way, and you can now jump back to the main text in the Breaking the URI down into its components section.