Question:
My question, to be clearer, is to create a server with mongodb in a cloud hosting (for example) and access it through another server.
Example: I have a mobile app. I hosted my mongoDB on cloud hosting (ubuntu). I want to connect my app to db on cloud server.
Is this possible? in what way?
I'm starting this apprenticeship and my question was precisely to create a server with MongoDB in a way that I could access it remotely. Outside of "localhost", you see? Unlike all the tutorials I've seen.
Answer:
Disregarding firewall and security issues, the logic for remotely connecting a MongoDB to a MySQL, for example, is the same.
In your terminal, in turn, you will use the following fragment to make the connection:
./mongo 192.168.0.1:27017
If the IP or server address is available and within the compliant, the connection will be successful.
In other words, you will raise the database on your cloud that is running fancifully over the IP 195.198.5.10
. So, to access this "driver", you only need to point the access to 195.198.5.10
. For example:
./mongo 195.198.5.10
Technically speaking, if you have an application, it will use this IP address to indicate where the bank is located.