js with express.js app, i deployed it to appfog but i´m not able or i don´t know how to connect my mongodb collections located on MongoHQ to my AppFog mongodb service.
MongoHQ provides you a mongo URI like:
mongodb://<user>:<password>@<hostname>:<port>/<databasename>
AppFog mongodb service provides you a environment variable called VCAP_SERVICE that contains all conf variables to connect your app to mongodb, but in the other hand i have my mongodb collections located on MongoHQ and i don´t know how to specify this MongoURI to my mongodb service on AppFog.
Hope you understand me, regards.
If I understand correctly, there might be two ways to solve your problem. Firstly, you may enable the MongoHQ add-on and AppFog will create a MongoHQ sandbox for you. You can get the MongoHQ URL by:
Since you said you have already got mongodb collections, you can clone your original collections to the one offered by AppFog via MongoHQ Web UI.
The other solution is don't worry about the MongoHQ add-on in AppFog. Just directly connect to MongoHQ (I use mongoose, but native driver should do the similar thing):
Actually I got a similar problem recently and I successfully deploy my nodejs+express app to Heroku using this method. I was not bothered to enable the mongohq add-on in Heroku since I have already got a MongoDB sandbox.
UPDATE I recently deployed a couple of applications in Heroku using mongodb native driver and monk to connect to a sandbox in MongoHQ. The code looks like: