Here are some frequently asked questions when connecting and running MongoDB as shown in the next video.

When you watch the next video, if you get any of these problems, attempt the solutions proposed here. If it doesn't work, please ask a question in the course Q&A!

1. I get a long error which contains the text "exception in initAndListen: 29 Data directory /data/db not found., terminating".

MongoDB needs a directory called /data/db to place data in it. Run the following commands in the terminal:

On Mac (Terminal.app): sudo mkdir -p /data/db && sudo chown `whoami` /data/db

On Windows (cmd.exe): md \data\db

2. I get a long error which contains the text "exception in initAndListen: 98 Unable to create/open lock file: /data/db/mongod.lock errno:13 Permission denied Is a mongod instance already running?, terminating".

This error should only happen on Mac or Linux. If it happens in Windows, please ask a question in the Q&A.

On Mac: sudo chown `whoami` /data/db

When shutting down MongoDB, press Control+C. Don't just close the terminal Window!