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 Getting Started With MongoDB Setting Up MongoDB

Edgar Burton
Edgar Burton
1,615 Points

Windows User - Totally lost with this tutorial. Does home brew exist for windows. Not clear on how to run commands in

Tutorial seems to be tailored for mac users. Unable to run any commands in Mongo. Using Windows 10. lost with this tutorial.

6 Answers

Daniel Breen
Daniel Breen
14,943 Points

The installation instructions for Windows don't explain how to make it easier to run mongod and mongo from the shell (powershell/command prompt) since we don't have homebrew. Hopefully this will help someone else down the road.

Windows 10 MongoDB PATH setup

  1. Find out where mongod.exe exists. For me it was C:\Program Files\MongoDB\Server\3.2\bin on 64-bit
    1a. Right-click the file it finds and select Open File Location
    1b. Copy the path from File Explorer's address bar by left-clicking to the right of the path then selecting all of it and pressing CTRL+C
  2. Hit the windows key and type environment. Select Edit the system environment variables (do not select Edit environment variable for your account)
  3. Click Environment Variables
  4. From the list, select the PATH variable, then click Edit...
  5. Click New
  6. CTRL+V to paste the path
  7. Click OK
  8. You can now run mongod, mongo, and all of the .exe files that exist in the \bin\ folder for MongoDB from powershell and command prompt
Konstantin Kovar
Konstantin Kovar
16,003 Points

This just saved my sanity, thanks a million!

Ken Alger
STAFF
Ken Alger
Treehouse Teacher

Edgar;

Don't get frustrated yet! There are lots of folks here willing to walk you through any issues. A few problem solving questions.

  1. Were you able to successfully install MongoDB? If not, see the link Cena Mayo posted.
  2. If you are trying to run commands against a MongoDB database do you have an instance of the MongoDB server running? If not from the Windows command line you can start one with the mongod command.
  3. Are you trying to run MongoDB commands in the Mongo Shell? That can be started with the mongo command.

Post back with an update and your fellow Treehousers will be happy to assist!

Ken

Scoop seems to be an alternative to Homebrew for Windows users. I haven't had experience with it but people compare it to Homebrew and like its ease to use. But homebrew is only for os.

Daniel Breen
Daniel Breen
14,943 Points

Also chocolatey

https://chocolatey.org/packages/mongodb.

Looks like scoop is more user friendly from my 5 minutes of research :)

You might also take a look at the MongoDB install instructions for Windows.

Homebrew is a way for Mac users to automatically download various software packages via the command line. It sounds like what you may be having difficulties with is using Windows' console application(i.e. command line). Is that the case?

Best, Cena

Hi Edgar: I used Homebrew on my Mac. Apparently it is only for os. Echoing what Brian said above, Scoop may be a solution for you: https://www.outcoldman.com/en/archive/2014/07/20/scoop/

Try adding the 'bin' directory from your MongoDB installation files to your system PATH variable so that you can just use the command mongod to run the server and then mongo to run the shell.