Get MongoDB installed and running on Windows.
- [Instructor] We'll start at the MongoDB download page for the community server. Scroll down to see the installation options for Windows. Download the msi installer and run it once it's complete. Run the file and as you go through the installation, you'll need to give permission, accept the license agreement, choose the complete installation, and wait while it installs.
You're going to need to give it the permission and then it'll finish up the installation for you. Once you've done the installation, let's find out where the file went. Under Program Files ... MongoDB ... Server ... 3.4 ... bin. This I where the files got put. The two things that are most important in here are Mongo and MongoD. But what I'm going to do is I'm going to copy this path so we can add it to the path for the environment variables.
So I'll check environment variables here. And you can see we can edit the system environment variables right here. And we're going to edit the path. So we're going to add a new item. We're going to paste what we copied. Click OK. And now you should be able to start both the Mongo server and the Mongo shell from the command line. So the first thing we need to do is create a data directory.
So we'll start the command prompt and do md \data. So we'll start with making the directory of data and the second thing we'll create is data DB. This is the file that Mongo is going to look for to use to store information about the database. So now you can start MongoD. It's not MongoDB, it's MongoD because it's the Mongo daemon. And you can see that it's actually started up. So let's open another command prompt.
And type Mongo. You can see that we have to start it off in the shell. So to make sure that everything works, let's go ahead and insert a file into the database. Name, Kirsten Hunter, you can put your name there. And you can see that it's inserted one file. So now we know that the database is all setup and running and we're ready to move on to the next section.
- Installing MongoDB for Windows and OS X
- Why Mongo?
- Document-oriented data
- Exploring the Mongo shell
- Importing data into the database
- Building an application in Node.js
- Tuning Mongo queries
- Replication and sharding