user3837739
user3837739

Reputation: 11

Heroku Sails Application accessing mongodb located on mongohq

Our application(node js using sails framework) is trying to access mongodb which is located on MongoHQ. When application is run from local system it is working fine. But once application is installed then values are not saving mongodb on mongohq rather its is saving somewhere in heruko. Configuration in adapter,js is as follows

adapters: { 'default': 'mongo', mongo: { module: 'sails-mongo', url: process.env.DB_URL, schema: 'true' } }

and DB_URL = mongodb://AdsPlaces:(redacted)@kahana.mongohq.com:10091/AdsPlaces.

Package content

dependencies: { "sails": "0.9.8", "sails-disk": "~0.9.0", "sails-mongo": "*", "skipper": "^0.1.8" }

When ever form is getting saved then values are getting saved somewhere on heroku default location but not on mongodb://AdsPlaces:(redacted)@kahana.mongohq.com:10091/AdsPlaces. Because of this our data is getting deleted each time updated application is installed on heroku. Please help

Upvotes: 1

Views: 187

Answers (1)

Jeff Wong
Jeff Wong

Reputation: 478

Check if the heroku instance current environment is production or development. By default, sails js will check for NODE_ENV to determine current environment. I believe that your application on heroku is running on development hence the models are using 'sails-disk' adapter.

You may try to check your config/env/production.js and with heroku toolbelt, run heroku config:set NODE_ENV=production.

Upvotes: 1

Related Questions