Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

I'm a newbie in NodeJS. In my first project, I use mongoose to connect local database. I want deploy it on Heroku Cloud. I search guide to do it. Everything is OK but when I load my page, it has error like picture.

I think the reason is there is no add-on for MongoDB in my app. Heroku has 2 Data Stories for MongoDB is Compose MongoDB and mLab. But both need to verify my account credit card.

What can I do now?

Thank for your help!!!

Error

like image 879
Loi Nguyen Phuc Avatar asked Mar 30 '16 23:03

Loi Nguyen Phuc


People also ask

Can we deploy MongoDB in Heroku?

ObjectRocket for MongoDB can be attached to a Heroku application via the CLI: A list of all plans available can be found here. $ heroku addons:create ormongo:5-mmap Creating ormongo-infinite-92036... done, (free) Adding ormongo-infinite-92036 to serene-brushlands-93817...

How install MongoDB URI to Heroku?

Heroku GUI methodGo to settings. Scroll down and you will see Config Vars. Click on Reveal Config Vars. Here, put the KEY as MONGODB_URI and the VALUE as your Mongo URI string (no need to add quotes here).

Is MongoDB free on Heroku?

MongoDB Atlas is easy and free to set up and deploy MongoDB on Heroku. The MongoDB Atlas is commonly referred to as the multi-cloud data application platform. It is an integrated data and cloud DB service that simplifies and accelerates how users build with data.


1 Answers

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:[email protected]: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.

like image 121
Muhammad Faisal Iqbal Avatar answered Sep 29 '22 07:09

Muhammad Faisal Iqbal