Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Databases Mongo Basics Go Further With Mongo Where to Next? Language Drivers and Sharding

Sanket Kale
Sanket Kale
447 Points

How to host mongo db database for an mobile application?

If I would like to locally host a mongoDB database on my PC for a test mobile application, can I do that? If yes, then how?

Sanket Kale
Sanket Kale
447 Points

Just to elaborate, I am trying to make an mobile application that reads blog related data from a database and displays in the application. Now these blog data should come directly from a mongodb database and not via any middleware webservice or something just for better speed. Now the question is how to turn my local PC into a database server for mongoDB so that my mobile application will be able to make connection to it and communicate the data.

1 Answer

Ken Alger
STAFF
Ken Alger
Treehouse Teacher

Sanket;

Running mongod essentially turns your PC into a MongoDB server. In order to connect to it from a mobile device you will need to set up your PC to have an IP address that is accessible from the internet. There are obviously many security implications with that as well.

For testing purposes, or if this project is strictly an academic exercise, you could write your mobile app to connect to your PC's IP address that is on your own local network to make sure that everything works.

Hope that helps and post back with further questions.

Happy coding,
Ken

Jesse Thompson
Jesse Thompson
10,684 Points

Hello Ken,

What online service would you recommend hosting a mongoDB server on?

Ken Alger
Ken Alger
Treehouse Teacher

Jesse;

I would look at their Atlas offering for cloud storage. It's convenient and they offer a free tier to get started.

Ken