LittleBill

mongodb在windows下安装方法

(1) 首先去官网下载mongoDB for windows zip包
mongoDB下载地址

(2) 把mongoDB解压缩到:E:WebToolsmongodb-win32-i386-1.8.2
并新建“log.txt”日志文件。新建“db”文件夹。

(3) 为mongoDB加载服务,并记录日志文件,并修改mondb安装路径:

E:WebToolsmongodb-win32-i386-1.8.2bin>mongod.exe --install --logpath=E:WebToolsmongodb-win32-i386-1.8.2log.txt --dbpath=E:WebToolsmongodb-win32-i386-1.8.2db

all output going to: E:WebToolsmongodb-win32-i386-1.8.2log.txt 
Creating service MongoDB. 
Service creation successful. 
Service can be started from the command line via 'net start "MongoDB"'. 

E:WebToolsmongodb-win32-i386-1.8.2bin> 

(4) 启动mongoDB服务:

E:WebToolsmongodb-win32-i386-1.8.2bin>net start mongodb 

Mongo DB 服务已经启动成功。 

E:WebToolsmongodb-win32-i386-1.8.2bin> 

(5) 完成!进入mongoDB啦:

E:WebToolsmongodb-win32-i386-1.8.2bin>mongo 
MongoDB shell version: 1.8.2 
connecting to: test 
> 3+3 
6 
> db 
test 
> help 
        db.help()                    help on db methods 
        db.mycoll.help()             help on collection methods 
        rs.help()                    help on replica set methods 
        help connect                 connecting to a db help 
        help admin                   administrative help 
        help misc                    misc things to know 
        help mr                      mapreduce help 

        show dbs                     show database names 
        show collections             show collections in current database 
        show users                   show users in current database 
        show profile                 show most recent system.profile entries with time >= 1ms 
        use <db_name>                set current database 
        db.foo.find()                list objects in collection foo 
        db.foo.find( { a : 1 } )     list objects in foo where a == 1 
        it                           result of the last line evaluated; use to further iterate 
        DBQuery.shellBatchSize = x   set default number of items to display on shell 
        exit                         quit the mongo shell 
> exit 
bye 

E:WebToolsmongodb-win32-i386-1.8.2bin>