How to connect mongodb with nodejs on Cloud9?



I’m new to Clould 9.
I flowed the instruct of this article Setting Up MongoDB

but when i connect the mongodb with node mongo.connect( 'mongodb://'+ process.env.IP +':28017/shortener', function ( err, db ) {

i got this error invalid schema, expected mongodb :frowning:
so, what’s the ip and port of the mongodb on my workspace?


Newbie here too.

I did not get the same error as you, but when started mongo db by running mongod --bind_ip=$IP --dbpath=/home/ubuntu/workspace/data --nojournal --rest I noticed a log message MongoDB starting : pid=... port=27017 dbpath=... host= ... with a different port than the provided in the article you mention. So using a connection string ‘mongodb://’ + process.env.IP + ‘:’ + ‘27017/mymongodb’ worked for me.