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 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.