Document directory
- Download
- Unzip and install
- Create a data directory
- Run and connect to the MongoDB Server
- Further study
Original address: http://tq-zone.appspot.com/mongodb_quickstart_windows
- Download
- 32-bit version
- 64-bit version
- Unzip and install
- Create a data directory
- Run and connect to the MongoDB Server
- Further study
Download
Directly Using pre-compiled binary files to install MongoDB is the simplest and recommended method.
32-bit version
. We recommend that you download the production release version, but it is stable.
64-bit version
.
Note: We recommend that you use a 64-bit version of MongoDB. Of course, you must use it on a 64-bit Windows platform.
Unzip and install
Decompress the downloaded file to any directory (C: \ is a good choice ). For convenience, you can change the directory name MongoDB-xxx to Mongo. In fact, the installation has been completed.
Create a data directory
By default, MongoDB stores the data in the \ data \ dB path, but does not automatically create it. Therefore, we need to manually complete it.
C:> mkdir \data C:> mkdir \data\db
Of course, you can also perform this operation on my computer.
Run and connect to the MongoDB Server
The home page uses two important files:
- Mongod.exe-MongoDB database server program
- Cmd.exe-shell used for management
To start the MongoDB database, you can double-click d.exe on "My Computer" or execute the following statement in the command line window:
C:> cd \my_mongo_dir\bin
C:\my_mongo_dir\bin > mongod
Note: there are still some problems with using the MongoDB database server program as a Windows service, but it will be implemented in the future.
Now let's start the Administrator shell. You can double-click cmd.exe in "My Computer" or run it in the command line window. In bad condition, cmd.exe connects to the mongod server running on localhost and opens the test database. Run Mongo -- help to view other options.
Code
C:> cd \my_mongo_dir\bin
C:\my_mongo_dir\bin> mongo
> // the mongo shell is a javascript shell connected to the db
> 3+3
6
> db
test
> // the first write will create the db:
> db.foo.insert( { a : 1 } )
> db.foo.find()
{ _id : ..., a : 1 }
Congratulations! We have completed the first step of using MongoDB.
Further study
- Tutorial
- Windows Quick Links
- Mongo Shell