Connect mongo db to remote nodejs server
I am using a nodejs server and connecting to Mongo DB locally using mongoose like:
mongooseQ.connect("mongodb://localhost:27017/YepiMobile");
How can I connect to a mongo db residing on a remote server from my machine?
Something like:
mongooseQ.connect("mongodb://remote.server.com:27017/YepiMobile");
+3
source to share
1 answer
Was there a second connection attempt for you by reading the Mongoose documentation, it looks like you did it right:
mongoose.connect('mongodb://username:password@host:port/database?options...');
Perhaps you are missing the credentials on the server? See this link for more information: http://mongoosejs.com/docs/connections.html or see MongoDB connection documentation: http://docs.mongodb.org/manual/reference/connection-string/ .
+4
source to share