Connecting to MongoDB

In order to be able to interact with a MongoDB instance, we first need to be sure that our server is running it. Then, we can access it through the Mongo shell application. In Chapter 1, Setting Up Your Workspace, we covered in some detail how to install and get MongoDB running on your specific operating system. You should go through these steps if you have not done so already. Once you have verified that MongoDB is running, open the MongoDB shell for your operating system.

Linux and Mac OS X

Start a console and run the following:



Start your command prompt and run the following:


You will see a prompt starting with the > character. From here, we can issue commands to MongoDB interactively ...

Get Learning Node.js for Mobile Application Development now with the O’Reilly learning platform.

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.