|
Installation and Configuration
Installing MongoDB on Windows -- Part 1
Download correct version
.
- Run wmic os get osarchitecture from command prompt
- MongoDB for Windows Server 2008 R2
- MongoDB for Windows 64-bit
- MongoDB for Windows 32-bit
- Windows XP and versions below are not supported
- Windows Server 2008 R2 or Windows 7 need hotfix 2731284
Extract to C:\
.
- You can then rename the folder created
- MongoDB is self-contained
Create data and log folders
.
- Data folder: md c:\data\db
- Log folder: md c:\path\to\mongodb\log
Create config file mongo.cfg
.
- Enter log file path into new config file:
echo logpath=c:\path\to\mongodb\log\mongo.log > c:\path\to\mongodb\mongod.cfg
Starting: from a command prompt
.
- Open a command prompt
- Type: c:\path\to\mongodb\bin\mongod.exe
- If using another data folder:
c:\path\to\mongodb\bin\mongod.exe --dbpath "drive:\path\to\data"
Connect to MongoDB
.
- Open another command prompt
- Type: c:\path\to\mongodb\bin\mongod.exe
- Use the default database: use mydb
- Save a test document: db.test.save({a:1})
- Find the test document: db.test.find()
|
|