MongoDB学习:(二)MongoDB简单使用
MongoDB使用:
执行mongodb的操作之前,我们需要运行命令,来进入操作命令界面
>mongo

提示该错误,说明我们系统缺少一个补丁,该补丁我百度盘连接为:https://pan.baidu.com/s/1pKPyPoJ
官方地址为:http://hotfixv4.microsoft.com/Windows%207/Windows%20Server2008%20R2%20SP1/sp2/Fix405791/7600/free/451413_intl_x64_zip.exe
Hotfix KB2731284 or later update is not installed这个问题,从官方文档的另一段话:
If you are running any edition of Windows Server 2008 R2 or Windows 7, please installa hotfix to resolve an issue with memory mapped files on Windows.
大意是:如果您运行的是任何版本的Windows Server 2008 R2或Windows 7,请安装修复程序来解决一个内存映射文件在Windows的问题。
1:安装补丁
下载好后,双击,会解压出来一个补丁文件,安装该补丁文件。安装完需要重启.....
(安装完貌似也还是报这个错,貌似不影响使用。以后在研究)


MongoDB简单使用:
启动mongodb:
>mongo
查看当前数据库信息
>show dbs
创建数据库,名字随意 use+数据库名字
>use firstdb

Mongodb插入数据 Insert:
>db.people.insert({"name":"表格1的数据","text":123456}) 在firstdb库的集合people中插入文档(mongodb数据都是文档性质)

Mongodb查看数据 Select--find:
>db.people.find() 查找所有数据
>db.people.find({"text":9999})

Mongodb修改数据 update:
>db.people.update 如图,不解释了

Mongodb删除数据 remove:
>db.people.remove 如图,不解释了

如上,就是MongoDB的基本操作,后续一章写点啥,还没想好,想好了再更新。
来自为知笔记(Wiz)