89672

Connect mongo db to remote server nodejs

Question:

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.com:27017/YepiMobile");

Answer1:

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: <a href="http://mongoosejs.com/docs/connections.html" rel="nofollow">http://mongoosejs.com/docs/connections.html</a>, or see MongoDB's connection documentation: <a href="http://docs.mongodb.org/manual/reference/connection-string/" rel="nofollow">http://docs.mongodb.org/manual/reference/connection-string/</a>.

Recommend

  • Visual Studio 2008 (C#) with SQL Compact Edition database error: 26
  • intellij IDEA - create android app failed
  • How to debug presto server project?
  • How to find tail rows of a data frame that satisfy set criteria?
  • Java Caching frameworks for maintaining huge data
  • Meteor oplog for Mongo 2.6
  • Installing PAR::Packer on Windows, dmake error 255
  • How to make a user wait with Laravel
  • Flex/AS3 very strange simple Number operation issue
  • MongoDB GeoJSON “Can't extract geo keys from object, malformed geometry?” when inserting type P
  • Mongodb update() vs. findAndModify() performace
  • call a java program from a webapp in tomcat server - the java program is out side of tomcat server
  • What is ./.local/share/Trash (Unix) [closed]
  • Regex for nested values
  • CORS with socket.io
  • Spark (Scala) Writing (and reading) to local file system from driver
  • mave 3.2 not able to access local nexus instance return 502 code
  • VBA Excel, loop through variables
  • converter json to two dimensional array
  • How Get arguments value using inline assembly in C without Glibc?
  • Tomcat memory Leak
  • Custom preprocessing in caret
  • Graphics.CopyFromScreen [Web application] + The handle is invalid
  • ADO and msqli connections very slow
  • How can I extract results of aggregate queries in slick?
  • Needing to do .toArray() to get output of mongodb .find() on key name not value
  • Typescript - Unable to get 'import' statement to function
  • Cannot resolve symbol 'MyApi'
  • Reading JSON from a file using C++ REST SDK (Casablanca)
  • MongoDB in PHP using aggregate to group by _id is null not working
  • SignalR .NET Client Invoke throws an exception
  • Azure Cloud Service Web Role web pages do not load
  • javaw.exe and eclipse startup problems
  • Running a C# exe file
  • Function pointer “assignment from incompatible pointer type” only when using vararg ellipsis
  • How to disable jQuery.jplayer autoplay?
  • What are the advantages and disadvantages of reading an entire file into a single String as opposed
  • coudnt use logback because of log4j
  • Turn off referential integrity in Derby? is it possible?
  • Running Map reduces the dimensions of the matrices