{"id":384,"title":"mongodb\u6570\u636e\u5e93\u6dfb\u52a0\u53ca\u5220\u9664","good":0,"bad":0,"hit":2227,"created_at":"2018-08-01 23:36:33","content":"
1\u8fdb\u5165mongo:<\/p>
[root@localhost soft]# mongo<\/p>
MongoDB shell version: 3.2.20<\/p>
connecting to: test<\/p>
<\/p>
2\u663e\u793a\u6570\u636e\u5e93<\/p>
> show dbs<\/p>
local 0.000GB<\/p>
<\/p>
3\u5efa\u4e00\u4e2a\u65b0\u7684\u6570\u636e\u5e93<\/p>
> use centos_hr_study<\/p>
switched to db centos_hr_study<\/p>
<\/p>
4\u663e\u793a\u5f53\u524d\u6240\u5728\u6570\u636e\u5e93<\/p>
> db<\/p>
centos_hr_study<\/p>
<\/p>
5\u4e3a\u4ec0\u4e48\u65b0\u5efa\u7684\u5e93\u6ca1\u663e\u793a\uff08\u539f\u56e0\uff1a\u9700\u8981\u63d2\u5165\u6570\u636e\u624d\u663e\u793a)<\/p>
6\u63d2\u5165\u6570\u636e<\/p>
> db.centos_hr_study.insert({"name":"\u8fd9\u662f\u5728\u865a\u62df\u673a\u4e2d\u6dfb\u52a0\u7684\u4e00\u4e2a\u5b66\u4e60\u5e93"})<\/p>
WriteResult({ "nInserted" : 1 })<\/p>
\u518d\u6b21\u67e5\u770b\u5c31\u53ef\u4ee5\u770b\u5230\u65b0\u6dfb\u52a0\u7684\u6570\u636e\u5e93\u4e86<\/p>
> show dbs<\/p>
centos_hr_study 0.000GB<\/p>
local 0.000GB<\/p>
> <\/p>
<\/p>
7\u5220\u9664\u6570\u636e\u5e93<\/p>
> db.dropDatabase()<\/p>
{ "dropped" : "centos_hr_study", "ok" : 1 }<\/p>
> show dbs<\/p>
local 0.000GB<\/p>
<\/p>
\u518d\u5efa\u4e00\u6b21\u6570\u636e\uff1a<\/p>
> use centos_hr_study<\/p>
switched to db centos_hr_study<\/p>
> db.centos_hr_study.insert({"name":"\u8fd9\u662f\u4e00\u4e2a\u5728centos\u4e2d\u5efa\u7acb\u7684\u7528\u4e8e\u5b66\u4e60\u7684mongodb\u6570\u636e\u5e93"})<\/p>
WriteResult({ "nInserted" : 1 })<\/p>
> show dbs<\/p>
centos_hr_study 0.000GB<\/p>
local 0.000GB<\/p>
> <\/p>
<\/p>
\u5982\u679c\u88c5\u4e86MongoDB Compass Community\u53ef\u4ee5\u5f88\u5f62\u8c61\u7684\u770b\u5230\u6211\u4eec\u63d2\u5165\u7684\u6570\u636e\uff1a<\/p>
<\/p>"}