1、下载并安装MongoDB服务
下载地址:mongodb-win32-x86_64-2008plus-ssl-3.2.8-signed
可直接运行mongod命令启动MongoDB服务器,也可以将MongoDB安装为服务在后台运行。
以管理员身份打开命令行,并进入MongoDB的bin目录下,执行以下命令
mongod --logpath "D:Program FilesMongoDBServerlogmongo.log" --logappend --dbpath "D:Program FilesMongoDBServerdata" --directoryperdb --serviceName "MongoDB" --serviceDisplayName "MongoDB" --install
即可将MongoDB以服务的形式安装到windows
2、下载GUI客户端Robomongo
下载地址:robomongo-0.9.0-rc9-windows-x86_64-0bb5668
安装后打开robomongo即能连接到本地的MongoDB
3、测试
打开robomongo,新建一个名称为mongo,地址为:localhost,端口号为:27017的连接
新建一个数据库Demo
右键Demo库,打开shell客户端,往user集合中新增一个数据
db.user.insert({"name":"贾宝玉","age":"21"});
继续编写语句查询刚刚新增的数据
db.user.find()