javascript - Connect mongo db to remote server nodejs - Stack Overflow

I nave nodejs server and connecting to Mongo DB locally using mongoose as:mongooseQ.connect("mongo

I nave nodejs server and connecting to Mongo DB locally using mongoose as:

mongooseQ.connect("mongodb://localhost:27017/YepiMobile"); 

How can I connect to mongo db that locating on remote server from my machine?

Something like:

mongooseQ.connect("mongodb://remote.server:27017/YepiMobile"); 

I nave nodejs server and connecting to Mongo DB locally using mongoose as:

mongooseQ.connect("mongodb://localhost:27017/YepiMobile"); 

How can I connect to mongo db that locating on remote server from my machine?

Something like:

mongooseQ.connect("mongodb://remote.server.:27017/YepiMobile"); 
Share Improve this question edited Sep 22, 2017 at 17:57 CommunityBot 11 silver badge asked Sep 11, 2014 at 14:53 SimchaSimcha 3,4007 gold badges30 silver badges44 bronze badges 1
  • Does the above fail when you put in the correct hostname for the remote server? It looks like it should work. What's the error you see if it fails? – wdberkeley Commented Sep 11, 2014 at 18:58
Add a ment  | 

1 Answer 1

Reset to default 5

Does the second connection attempt fail for you, by reading Mongoose's documentation it seems like you have done it correctly:

mongoose.connect('mongodb://username:password@host:port/database?options...');

Maybe you are missing the credentials to the server? See this link for more information: http://mongoosejs./docs/connections.html, or see MongoDB's connection documentation: http://docs.mongodb/manual/reference/connection-string/.

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744841761a4596597.html

相关推荐

  • javascript - Connect mongo db to remote server nodejs - Stack Overflow

    I nave nodejs server and connecting to Mongo DB locally using mongoose as:mongooseQ.connect("mongo

    2天前
    60

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信