Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

Databases Mongo Basics Understanding MongoDB Store Your Blog In Mongo

what if we didnt install with homebrew?

i am on a windows machine so i couldnt use homebrew. how would i run the mongob and mongo command from my project folder opposed to the bin folder? i tried cd and a relative path all the way to mongo and it still didnt work. when i run it from my bin and i run ls() in mongo shell i see all the files in bin not my project folder. how would i start the shell in my project folder in windows?

If it's in your downloads folder than try to extract the mongo folder out of the downloads folder on your windows machine.

Hakim Rachidi thanks for the reply. i have the mongodb folder on my c drive. properly installed like in the video. i moved my project inside C:\Program Files\MongoDB\practice. when i try to start mongo shell from my project folder i type "cd ../server/4.0/bin/mongo", however i receive "The system cannot find the path specified". however if i run "cd ../server/4.0/bin/" from my project folder it takes me there, and if i run mongo it starts the shell. however, i am trying to start the shell from my project folder so when i run ls() in the shell it will show my project folder files and not bin files. thanks

2 Answers

Making Mongo available from everywhere

If i got you right you want to execute mongo (mongod, mongodump, ...) in Windows from everywhere in your file system. To do so you have to add the path to your bin folder to the windows PATH environment variable.

1. Step

To permanently set the environment variable on windows follow the detailed step by step instruction on SO from MatPag.

In Step 9 of the instruction you have to add your path to the bin folder of the mongo installation. After changing the PATH environment variable (and saving the changes in the control panel) don't forget to restart your machine.

2. Step

Start the mongo server from where ever you want with

mongod

3. Step

Go into your project folder, where you can now run

mongo

to start a mongo shell session. Here you can load the seed script via

load("<relative-path-to-script>");

from with in the mongo shell.

don't run mongo directly from the folder, just add it to the path and you can execute mongo and mongod just typing it.