一.项目前期准备所遇bug总结
(1)关于window7版本下安装mongodb
(a)必备环境(软件):node,npm,git
(b)MongoDB 提供了可用于 32 位和 64 位系统的预编译二进制包,你可以从MongoDB官网下载安装,MongoDB 预编译二进制包下载地址:https://www.mongodb.com/download-center#community
MongoDB for Windows 64-bit适合 64 位的 Windows Server 2008 R2, Windows 7 , 及最新版本的 Window 系统。
MongoDB for Windows 32-bit适合 32 位的 Window 系统及最新的 Windows Vista。 32 位系统上 MongoDB 的数据库最大为 2GB。
MongoDB for Windows 64-bit Legacy适合 64 位的 Windows Vista, Windows Server 2003, 及 Windows Server 2008 。
(c)根据你的系统下载 32 位或 64 位的 .msi 文件,下载后双击该文件,按操作提示安装即可。安装过程中,你可以通过点击 "Custom(自定义)" 按钮来设置你的安装目录。


(D)安装完程序之后会在你指定的安装目录下有一个安装包。安装包里找到bin目录文件,我此次安装的项目目录为 C:\Program Files\MongoDB\Server\3.4\bin
详细如图3所示
(E)创建数据目录
MongoDB将数据目录存储在 db 目录下。但是这个数据目录不会主动创建,我们在安装完成后需要创建它。请注意,数据目录应该放在根目录下((如: C:\ 或者 D:\ 等 )。
此次项目中我把数据创建到了C盘下,目录结构大致为:C:\data\db
如图4
(F)在图三中,打开一个名为mongod的应用程序,打开之后,如果能够显示图5的界面说明我们的数据库已经成功运行了
(G)测试当前数据库。
打开图3中一个名为mongo的应用程序,也为终端命令,
>mongo
MongoDBshell version:3.0.6
connecting to:test…
db命令用于查看当前操作的文档(数据库):
>db
test>
在集合(表)中插入文档(数据)
>db.runoob.insert({x:10})
WriteResult({"nInserted":1})
查找所有文档数据
>db.runoob.find()
{"_id":ObjectId("5604ff74a274a611b0c990aa"),"x":10}>
新建集合(表)
use 表名 (注意这一步骤走完之后并不能在数据库中查到这个表,至少要插入一条数据才行,即执行命令db.表名.insert({数据}))
注意:
如果终端打开数据库,具体操作为:
cd 刚刚说的那个bin文件下
执行mongod --dbpath C:\data\db
如图6
(H)可以安装一个客户端数据库软件。方便查找
http://en.freedownloadmanager.org/Windows-PC/MongoChef-Core-FREE.html
操作步骤为
http://jingyan.baidu.com/article/6181c3e0be3173152ef153cf.html




http://blog.csdn.net/sinat_25127047/article/details/50560167
网友评论