{"id":3429,"date":"2018-11-28T15:08:48","date_gmt":"2018-11-28T07:08:48","guid":{"rendered":"http:\/\/www.xttblog.com\/?p=3429"},"modified":"2018-11-28T15:08:48","modified_gmt":"2018-11-28T07:08:48","slug":"%e8%af%a6%e8%a7%a3-mongodb-%e4%b8%ad%e7%9a%84%e7%94%a8%e6%88%b7%e8%a7%92%e8%89%b2%e6%9d%83%e9%99%90%e7%9a%84%e5%88%86%e9%85%8d%e4%b8%8e%e6%8e%a7%e5%88%b6","status":"publish","type":"post","link":"https:\/\/www.xttblog.com\/?p=3429","title":{"rendered":"\u8be6\u89e3 MongoDB \u4e2d\u7684\u7528\u6237\u89d2\u8272\u6743\u9650\u7684\u5206\u914d\u4e0e\u63a7\u5236"},"content":{"rendered":"<p>\n\tMongoDB \u4f5c\u4e3a\u4e00\u4e2a\u5206\u5e03\u5f0f\u6587\u4ef6\u5b58\u50a8\u7684\u6570\u636e\u5e93\u4f7f\u7528\u7684\u4eba\u8d8a\u6765\u8d8a\u591a\u3002\u5b83\u91cc\u9762\u5305\u542b\u5f88\u591a\u5185\u7f6e\u7684\u89d2\u8272\u548c\u6743\u9650\uff0c\u672c\u6587\u6765\u4ecb\u7ecd\u4e00\u4e0b\u5b83\u7684\u6743\u9650\u8bbe\u8ba1\u548c\u4f7f\u7528\u3002\n<\/p>\n<p>\n\t\u5728\u4ecb\u7ecd MongoDB \u7684\u6743\u9650\u7ba1\u7406\u4e4b\u524d\uff0c\u6211\u4eec\u5148\u6765\u56de\u987e\u4e00\u4e0b\u76ee\u524d\u6bd4\u8f83\u6d41\u884c\u7684\u6743\u9650\u7ba1\u7406\u65b9\u6848\u3002\n<\/p>\n<p>\n\t<img decoding=\"async\" alt=\"\u6743\u9650\u7cfb\u7edf\u7684\u8bbe\u8ba1\u4e0e\u5b9e\u73b0\" src=\"https:\/\/raw.githubusercontent.com\/xmt1139057136\/xttblog\/master\/rbac-mongodb-secure.png\" style=\"width: 554px;height: 290px\" \/>\n<\/p>\n<p>\n\t\u4e0a\u56fe\u662f\u76ee\u524d\u591a\u5c11\u6743\u9650\u7cfb\u7edf\u7684\u8bbe\u8ba1\u4e0e\u5b9e\u73b0\u3002\n<\/p>\n<p>\n\tMongoDB 2.6 \u4ece\u7248\u672c\u5f00\u59cb\uff0cMongoDB \u5df2\u7ecf\u5f00\u59cb\u5c1d\u8bd5\u5f15\u5165\u76f8\u5bf9\u7cbe\u7ec6\u7684\u6743\u9650\u63a7\u5236\uff0c\u4e0d\u8fc7\u76f4\u5230 MongoDB3.0 \u7248\u672c\u6743\u9650\u4f53\u7cfb\u624d\u7b97\u76f8\u5bf9\u5b8c\u5584\uff0c\u6240\u4ee5\u672c\u6587\u5c06\u4e3b\u8981\u4ecb\u7ecd MongoDB3.0 \u7248\u672c\u7684\u6743\u9650\u63a7\u5236\u673a\u5236\u3002\n<\/p>\n<h2>\n\tMongoDB \u4e2d\u7684\u6743\u9650<br \/>\n<\/h2>\n<p>\n\tMongoDB \u7684\u6743\u9650\u8bbe\u8ba1\u4e0e\u4e0a\u9762\u7c7b\u4f3c\u3002MongoDB \u4e2d\u7684\u6743\u9650\u4e3b\u8981\u6709\u4e0b\u9762 6 \u4e2a\u5bf9\u8c61\u7ec4\u6210\u3002\n<\/p>\n<ul>\n<li>\n\t\tuser\uff1a\u7528\u6237\uff0c\u7528\u4e8e\u63d0\u4f9b\u5ba2\u6237\u7aef\u8fde\u63a5 MongoDB \u7684\u8ba4\u8bc1\u8d26\u6237\n\t<\/li>\n<li>\n\t\trole\uff1a\u89d2\u8272\uff0c\u6570\u636e\u6743\u9650\u7684\u96c6\u5408\uff0c\u521b\u5efa\u7528\u6237\u7684\u65f6\u5019\u5fc5\u987b\u8981\u6307\u5b9a\u5bf9\u5e94\u7684\u89d2\u8272\uff0c\u5426\u5219\u7528\u6237\u65e0\u6cd5\u64cd\u4f5c\u6570\u636e\u5e93\n\t<\/li>\n<li>\n\t\tresource\uff1a\u8d44\u6e90\uff0c\u5305\u62ecdatabase\u6216collection\u4e5f\u53ef\u4ee5\u662fdatabase\u548ccollection\u7684\u7ec4\u5408\u3002\u4f8b\u5982\uff1a{ db: &lt;database&gt;, collection: &lt;collection&gt; } \u5f53\u7136\u4f60\u4e5f\u53ef\u80fd\u770b\u5230\u4e00\u79cd\u7279\u6b8a\u7684\u8d44\u6e90\uff1a{&quot;cluster&quot; : true}\uff0c\u5b83\u5176\u5b9e\u8868\u793a\u7684\u662f\u5168\u5c40\u8d44\u6e90\n\t<\/li>\n<li>\n\t\tactions\uff1a\u6743\u9650\u64cd\u4f5c\uff0c&quot;actions&quot; \u5b9a\u4e49\u4e86&quot;user&quot;\u80fd\u591f\u5bf9 &quot;resource document&quot;\u6267\u884c\u7684\u64cd\u4f5c\u3002\u4f8b\u5982\uff0c\u589e\u5220\u6539\u67e5\u5305\u62ec\u5982\u4e0b\u64cd\u4f5c\uff1afind\u3001insert\u3001remove\u3001update\u3002\u4ee5\u53ca\u5176\u4ed6 serverStatus\u3001killop\u3001inprog\u3001killCursors \u7b49\u66f4\u9ad8\u7ea7\u6743\u9650\n\t<\/li>\n<li>\n\t\tprivilege\uff1a\u6743\u9650\uff0c&quot;privilege&quot; \u662f\u4e00\u7ec4&quot;resource&quot; \u548c &quot;actions&quot; \u7684\u7ec4\u5408\n\t<\/li>\n<li>\n\t\tauthenticationDatabase\uff1a\u8ba4\u8bc1\u5e93\uff0c\u5373\u521b\u5efa\u89d2\u8272\u6216\u7528\u6237\u65f6\u6240\u5728\u7684\u5e93\u3002\u4f8b\u5982\uff0c\u5728 admin \u4e0b\u521b\u5efa\u4e86 MongoDB \u7528\u6237\u90a3\u4e48\u767b\u9646\u7684\u65f6\u5019\u9700\u8981\u6307\u5b9a\u8ba4\u8bc1\u5e93\n\t<\/li>\n<\/ul>\n<h2>\n\tMongoDB \u521b\u5efa\u89d2\u8272<br \/>\n<\/h2>\n<p>\n\tMongoDB \u91cc\u89d2\u8272\u5206\u4e3a &rdquo;\u5185\u5efa\u89d2\u8272&ldquo; \u548c &rdquo;\u7528\u6237\u81ea\u5b9a\u4e49&ldquo; \u89d2\u8272\u4e24\u79cd\u3002\u5185\u5efa\u89d2\u8272\u662f MongoDB \u4e3a\u4e86\u65b9\u4fbf\u7528\u6237\u7ba1\u7406\u548c\u5185\u90e8\u64cd\u4f5c\u8fdb\u884c\u7684\u9884\u5b9a\u4e49\u7684\u4e00\u4e9b\u6743\u9650\u3002\u591a\u6570\u65f6\u5019\u4e3a\u4e86\u7cbe\u7ec6\u5316\u6743\u9650\u63a7\u5236 MongoDB \u7684\u5185\u5efa\u89d2\u8272\u65e0\u6cd5\u6ee1\u8db3\u6211\u4eec\u7684\u9700\u6c42\uff0c\u56e0\u6b64\u9700\u8981 DBA \u81ea\u5b9a\u4e49\u89d2\u8272\u6765\u8fdb\u884c\u66f4\u52a0\u8be6\u7ec6\u7684\u6743\u9650\u63a7\u5236\u3002\n<\/p>\n<pre class=\"brush:sql;\">\r\nuse xttblog \/\/\u8fdb\u5165 xttblog \u6570\u636e\u5e93\r\n\r\ndb.createRole(\r\n&nbsp; &nbsp; {&nbsp;\r\n&nbsp;&nbsp; &nbsp;role:&quot;testrole&quot;,\/\/\u89d2\u8272\u540d\u79f0\r\n&nbsp;&nbsp; &nbsp;privileges: [ \/\/ \u6743\u9650\u96c6\r\n&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;{\r\n&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;resource: \/\/\u8d44\u6e90&nbsp;\r\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {\r\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; db:&quot;jhr&quot;, \/\/\u521b\u5efa\u7684testrole\u89d2\u8272\u5177\u6709\u5bf9xttblog\u5e93\u7684\u64cd\u4f5c\u6743\u9650\uff0c\u5177\u4f53\u6743\u9650\u5efaactions\r\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; collection:&quot;&quot; \/\/xttblog\u5e93\u4e0b\u5bf9\u5e94\u7684\u96c6\u5408\u540d.\u5982\u679c\u4e3a&quot;&quot;\u8868\u793a\u6240\u6709\u96c6\u5408\r\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; },\r\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; actions: [ \"find\", \"insert\", \"remove\",\"update\" ] \/\/\u89d2\u8272\u53ef\u8fdb\u884c\u7684\u64cd\u4f5c\uff0c\u6ce8\u610f\u8fd9\u91cc\u662f\u4e00\u4e2a\u6570\u7ec4\r\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }\r\n&nbsp; &nbsp; &nbsp; &nbsp; ],\r\n&nbsp; &nbsp; &nbsp; &nbsp; roles: [] \/\/ \u662f\u5426\u7ee7\u627f\u5176\u4ed6\u7684\u89d2\u8272\uff0c\u5982\u679c\u6307\u5b9a\u4e86\u5176\u4ed6\u89d2\u8272\u90a3\u4e48\u65b0\u521b\u5efa\u7684\u89d2\u8272\u81ea\u52a8\u7ee7\u627f\u5bf9\u5e94\u5176\u4ed6\u89d2\u8272\u7684\u6240\u6709\u6743\u9650\uff0c\u8be5\u53c2\u6570\u5fc5\u987b\u663e\u793a\u6307\u5b9a\r\n&nbsp; &nbsp; }\r\n)\r\n<\/pre>\n<p>\n\t\u4e0a\u8ff0\u8bed\u53e5\u5728 xttblog \u5e93\u91cc\u521b\u5efa\u4e86\u4e00\u4e2a\u540d\u4e3a testrole \u7684\u89d2\u8272\uff0c\u8be5\u89d2\u8272\u5177\u6709\u5bf9\u6570\u636e\u5e93 xttblog \u4e0b\u7684\u6240\u6709\u96c6\u5408\u8fdb\u884c find\u3001insert\u3001remove\u3001update \u7684\u64cd\u4f5c\u7684\u6743\u9650\u3002\n<\/p>\n<p>\n\t\u89d2\u8272\u521b\u5efa\u5b8c\u6bd5\u540e MongoDB \u4f1a\u5728\u7cfb\u7edf\u5e93 admin \u4e0b\u521b\u5efa\u4e00\u4e2a\u7cfb\u7edf collection \u540d\u53eb system.roles \u91cc\u9762\u5b58\u50a8\u7684\u5373\u662f\u89d2\u8272\u76f8\u5173\u7684\u4fe1\u606f\u3002\n<\/p>\n<p>\n\t\u53ef\u4ee5\u4f7f\u7528\u4e0b\u9762\u7684\u8bed\u53e5\u5bf9\u521b\u5efa\u7684\u89d2\u8272\u8fdb\u884c\u67e5\u770b\u3002\n<\/p>\n<pre class=\"brush:sql;\">\r\ndb.getCollection(&#039;system.roles&#039;).find({})\r\n\r\ndb.system.roles.find();<\/pre>\n<p>\n\t\u4e5f\u53ef\u4ee5\u4f7f\u7528\u4e0b\u9762\u7684\u67e5\u8be2\u8bed\u53e5\u67e5\u770b\u89d2\u8272\u4fe1\u606f\u3002\n<\/p>\n<pre class=\"brush:sql;\">\r\ndb.getRole(&quot;testrole&quot;, \/\/\u8981\u67e5\u770b\u89d2\u8272\u7684\u540d\u5b57\r\n    { \r\n        showPrivileges: true \/\/\u6307\u5b9a\u67e5\u770b\u89d2\u8272\u4fe1\u606f\u7684\u65f6\u5019\u662f\u5426\u663e\u793a\u5b83\u6240\u62e5\u6709\u7684\u6743\u9650\u4fe1\u606f\uff0c\u4e5f\u53ef\u4e0d\u6307\u5b9a\r\n    } \r\n)\r\n\/\/ \u4e1a\u4f59\u8349\uff1awww.xttblog.com\r\ndb.getRoles(\r\n    {\r\n      rolesInfo: 1,\r\n      showPrivileges:true,\r\n      showBuiltinRoles: true\r\n    }\r\n)<\/pre>\n<p>\n\t\u89d2\u8272\u6743\u9650\u7684\u7ee7\u627f\u548c\u89d2\u8272\u6743\u9650\u56de\u6536\u3002\n<\/p>\n<pre class=\"brush:sql;\">\r\n\/\/\u89d2\u8272\u7ee7\u627f\r\ndb.grantRolesToRole(  \r\n    &quot;testrole&quot;,\r\n    [ \"otherrole1\",\"otherrole2\" ] \/\/ \u5c06 otherrole1\u3001otherrole2 \u4e24\u4e2a\u89d2\u8272\uff08\u5047\u8bbe\u4e4b\u524d\u5df2\u7ecf\u521b\u5efa\u597d\uff09\u7684\u6743\u9650\u6388\u4e88testrole\u89d2\u8272\r\n)\r\n\/\/ \u4e1a\u4f59\u8349\uff1awww.xttblog.com\r\n\/\/\u89d2\u8272\u6743\u9650\u56de\u6536\r\ndb.revokeRolesFromRole(\r\n    &quot;testrole&quot; ,\r\n    [ \"otherrole2\" ] \/\/ \u64a4\u9500testrole\u89d2\u8272\u4eceotherrole2\u89d2\u8272\u6240\u7ee7\u627f\u7684\u6240\u6709\u6743\u9650\r\n)<\/pre>\n<h2>\n\t\u89d2\u8272\u6388\u6743<br \/>\n<\/h2>\n<pre class=\"brush:sql;\">\r\ndb.grantPrivilegesToRole(\r\n    &quot;testrole&quot;,\r\n    [\r\n        {\r\n            resource: \/\/\u6743\u9650\u53ef\u64cd\u4f5c\u7684\u8d44\u6e90\r\n            {\r\n                db:&quot;xttblog&quot;,  \/\/ \u6388\u4e88testrole\u89d2\u8272\u5177\u6709\u64cd\u4f5cxttblog\u5e93\u7684\u6743\u9650\r\n                collection:&quot;&quot; \/\/ lidan_1\u5e93\u4e0b\u7684\u96c6\u5408 \u5982\u679c\u4e3a&quot;&quot; \u8868\u793a\u6240\u6709\u96c6\u5408\r\n            },                                                 \r\n            actions:  \/\/ \u6743\u9650\u5141\u8bb8\u7684\u64cd\u4f5c\r\n            [ \"createCollection\", \"dropCollection\",\"convertToCapped\"] \/\/\u6743\u9650\u53ef\u8fdb\u884c\u7684\u64cd\u4f5c\r\n        } \r\n    ]\r\n)<\/pre>\n<p>\n\t\u6267\u884c\u5b8c\u64cd\u4f5c\u540e testrole \u89d2\u8272\u4fbf\u53ef\u4ee5\u5bf9\u5e93 xttblog \u4e0b\u7684\u6240\u6709\u96c6\u5408\u8fdb\u884c &quot;createCollection&quot;, &quot;dropCollection&quot;,&quot;convertToCapped&quot; \u64cd\u4f5c\u3002\n<\/p>\n<h2>\n\t\u89d2\u8272\u6743\u9650\u56de\u6536<br \/>\n<\/h2>\n<pre class=\"brush:sql;\">\r\ndb.revokePrivilegesFromRole(\r\n  &quot;testrole&quot;,\r\n  [\r\n    {\r\n        resource: \/\/\u6743\u9650\u53ef\u64cd\u4f5c\u7684\u8d44\u6e90\r\n        {\r\n            db:&quot;xttblog&quot;,  \/\/ \u56de\u6536\u89d2\u8272\u5bf9\u5e93 xttblog \u7684 actions \u64cd\u4f5c\u6743\u9650\r\n            collection:&quot;&quot; \/\/  xttblog \u5e93\u4e0b\u6240\u6709\u7684\u96c6\u5408 \u5982\u679c\u4e3a&quot;&quot; \u8868\u793a\u6240\u6709\u96c6\u5408\r\n        },                                                 \r\n        actions:  \/\/ \u6743\u9650\u5141\u8bb8\u7684\u64cd\u4f5c\r\n        [ \"createCollection\", \"dropCollection\",\"convertToCapped\"] \/\/\u9700\u8981\u56de\u6536\u7684\u6743\u9650\r\n     } \r\n  ]\r\n)<\/pre>\n<p>\n\t\u6267\u884c\u5b8c\u64cd\u4f5c\u540e testrole \u89d2\u8272\u5bf9\u5e93 xttblog \u4e0b\u7684\u6240\u6709\u96c6\u5408\u65e0\u6cd5\u8fdb\u884c &quot;createCollection&quot;, &quot;dropCollection&quot;,&quot;convertToCapped&quot; \u64cd\u4f5c\u3002\n<\/p>\n<h2>\n\t\u5220\u9664\u89d2\u8272<br \/>\n<\/h2>\n<pre class=\"brush:sql;\">\r\ndb.dropRole(&quot;testrole&quot;) \/\/ \u5220\u9664\u89d2\u8272\u6bd4\u8f83\u7b80\u5355\u76f4\u63a5\u6307\u5b9a\u8981\u5220\u9664\u89d2\u8272\u7684\u540d\u79f0\u5373\u53ef<\/pre>\n<h2>\n\t\u521b\u5efa\u7528\u6237<br \/>\n<\/h2>\n<pre class=\"brush:sql;\">\r\n\/\/ \u6307\u5b9a\u5185\u5efa\u89d2\u8272\u6765\u521b\u5efa\u7528\u6237\r\ndb.createUser(\r\n    {\r\n        user:&#039;mongo&#039;, \/\/ \u7528\u6237\u540d\r\n        pwd:&#039;123&#039;,    \/\/ \u5bc6\u7801\r\n        roles:[ \r\n            {\r\n                role:&#039;root&#039;,\/\/ \u901a\u8fc7\u6307\u5b9a\u5185\u5efa\u89d2\u8272root \u6765\u521b\u5efa\u7528\u6237\r\n                db:&#039;admin&#039;  \/\/ \u6307\u5b9a\u89d2\u8272\u5bf9\u5e94\u7684\u8ba4\u8bc1\u6570\u636e\u5e93\uff0c\u5185\u5efa\u89d2\u8272\u901a\u5e38\u8ba4\u8bc1\u5e93\u4e3aadmin\r\n            }\r\n        ]\r\n    }\r\n);\r\n\/\/ \u6307\u5b9a\u81ea\u5b9a\u4e49\u89d2\u8272\u6765\u521b\u5efa\u7528\u6237\uff0c\u8fd9\u91cc\u662f\u5728admin\u4e0b\u521b\u5efa\u7684\u7528\u6237\u6545\u8ba4\u8bc1\u5e93\u4e5f\u662fadmin\r\ndb.createUser(\r\n    {  \r\n        user:&quot;mongo&quot;,\/\/ \u7528\u6237\u540d\r\n        pwd:&quot;123&quot;,   \/\/ \u5bc6\u7801\r\n        roles:[\"testrole\"] \/\/\u901a\u8fc7\u6307\u5b9a\u7528\u6237\u81ea\u5b9a\u4e49\u89d2\u8272\u6765\u521b\u5efa\u7528\u6237,\u6ce8\u610f\u8fd9\u91cc\u662f\u6570\u7ec4\r\n    }\r\n)<\/pre>\n<h2>\n\t\u67e5\u770b\u7528\u6237<br \/>\n<\/h2>\n<pre class=\"brush:sql;\">\r\ndb.getUser(&quot;mongo&quot;) \/\/ \u67e5\u770b\u7528\u6237\u6bd4\u8f83\u7b80\u5355\u53ea\u9700\u8981\u6307\u5b9a\u7528\u6237\u540d\u5373\u53ef<\/pre>\n<p>\n\t\u4e3a\u7528\u6237\u6dfb\u52a0\/\u56de\u6536\u89d2\u8272\n<\/p>\n<pre class=\"brush:sql;\">\r\nuse admin\r\n\/\/\u4e3a\u7528\u6237\u6dfb\u52a0\u89d2\u8272\r\ndb.grantRolesToUser(\r\n    &quot;mongo&quot;, \/\/ \u7528\u6237\u540d\r\n    [ \r\n        {\r\n            role: &quot;testrole&quot;, \/\/ \u9700\u8981\u6dfb\u52a0\u7684\u89d2\u8272\u540d \r\n            db: &quot;admin&quot; \/\/ \u89d2\u8272\u5bf9\u5e94\u7684\u8ba4\u8bc1\u5e93\uff0c\u5373\u89d2\u8272\u521b\u5efa\u65f6\u6240\u5728\u7684\u6570\u636e\u5e93\r\n        } \r\n    ]\r\n)\r\n\/\/\u5bf9\u7528\u6237\u7684\u89d2\u8272\u8fdb\u884c\u56de\u6536\uff0c\u5982\u679c\u5c06\u7528\u6237\u6240\u6709\u7684\u89d2\u8272\u90fd\u56de\u6536\u5b8c\u6bd5\uff0c\u90a3\u4e48\u7528\u6237\u53ea\u6709\u5bf9\u6240\u5c5e\u5e93\u7684\u8fde\u63a5\u6743\u9650\r\ndb.revokeRolesFromUser(\r\n    &quot;mongo&quot;, \/\/ \u7528\u6237\u540d\r\n    [ \r\n        {   \r\n            role: &quot;testrole&quot;, \/\/ \u9700\u8981\u56de\u6536\u7684\u89d2\u8272\u540d \r\n            db: &quot;admin&quot; \/\/ \u89d2\u8272\u5bf9\u5e94\u7684\u8ba4\u8bc1\u5e93\uff0c\u5373\u89d2\u8272\u521b\u5efa\u65f6\u6240\u5728\u7684\u6570\u636e\u5e93\r\n        } \r\n    ]\r\n)<\/pre>\n<h2>\n\t\u5220\u9664\u7528\u6237<br \/>\n<\/h2>\n<pre class=\"brush:sql;\">\r\ndb.dropUser(&quot;mongo&quot;); \/\/ \u5220\u9664\u7528\u6237\u6bd4\u8f83\u7b80\u5355\u76f4\u63a5\u6307\u5b9a\u7528\u6237\u540d\u5373\u53ef<\/pre>\n<p>\n\t\u597d\u4e86\uff0cMongoDB \u7684\u89d2\u8272\u6743\u9650\u5c31\u8fd9\u4e48\u7b80\u5355\u3002\u6700\u540e\u5f3a\u8c03\u4e00\u70b9\uff0c\u5728 MongoDB \u4e2d\u5220\u9664\u5e93\u548c\u96c6\u5408\u5e76\u4e0d\u4f1a\u7ea7\u8054\u5220\u9664\u5bf9\u5e94\u7684\u89d2\u8272\u548c\u7528\u6237\u3002\u56e0\u6b64\u5982\u679c\u60f3\u5f7b\u5e95\u5220\u9664\u5bf9\u5e94\u7684\u4e1a\u52a1\u5e93\u56e0\u8be5\u5148\u5220\u9664\u5e93\u53ca\u5176\u5bf9\u5e94\u7684\u89d2\u8272\u548c\u7528\u6237\u3002<\/p>\n<!-- <audio autoplay=\"autoplay\" height=\"100\" width=\"100\" hidden=\"true\"><source src=\"https:\/\/c.coka.la\/orAvPR.mp3\" type=\"audio\/mp3\"\/><\/audio><img decoding=\"async\" src=\"https:\/\/images.weserv.nl\/?url=https:\/\/ws3.sinaimg.cn\/large\/8fa5dcfcgy1g4em3rzar5j20ib089ae0.jpg\" alt=\"\u4e1a\u4f59\u8349\u516c\u4f17\u53f7\"\/> --><p><!-- <img decoding=\"async\" src=\"https:\/\/raw.githubusercontent.com\/xmt1139057136\/xttblog\/master\/8fa5dcfcgy1g4em3rzar5j20ib089ae0.jpg\" alt=\"\u4e1a\u4f59\u8349\u516c\u4f17\u53f7\"\/>--><img decoding=\"async\" src=\"https:\/\/saas.51autoparts.cn\/api\/admin\/sys-file\/oss\/file?fileName=84db51f8561e448f9a4fda2eff0811f9.jpg\" alt=\"\u4e1a\u4f59\u8349\u516c\u4f17\u53f7\"\/><\/p><p>\u6700\u540e\uff0c\u6b22\u8fce\u5173\u6ce8\u6211\u7684\u4e2a\u4eba\u5fae\u4fe1\u516c\u4f17\u53f7\uff1a\u4e1a\u4f59\u8349\uff08yyucao\uff09\uff01<b>\u53ef\u52a0\u4f5c\u8005\u5fae\u4fe1\u53f7\uff1a<font color=\"red\">xttblog2<\/font>\u3002\u5907\u6ce8\uff1a\u201c1\u201d\uff0c\u6dfb\u52a0\u535a\u4e3b\u5fae\u4fe1\u62c9\u4f60\u8fdb\u5fae\u4fe1\u7fa4\u3002\u5907\u6ce8\u9519\u8bef\u4e0d\u4f1a\u540c\u610f\u597d\u53cb\u7533\u8bf7\u3002<\/b>\u518d\u6b21\u611f\u8c22\u60a8\u7684\u5173\u6ce8\uff01\u540e\u7eed\u6709\u7cbe\u5f69\u5185\u5bb9\u4f1a\u7b2c\u4e00\u65f6\u95f4\u53d1\u7ed9\u60a8\uff01\u539f\u521b\u6587\u7ae0\u6295\u7a3f\u8bf7\u53d1\u9001\u81f3532009913@qq.com\u90ae\u7bb1\u3002\u5546\u52a1\u5408\u4f5c\u4e5f\u53ef\u6dfb\u52a0\u4f5c\u8005\u5fae\u4fe1\u8fdb\u884c\u8054\u7cfb\uff01<\/p><p>\u672c\u6587\u539f\u6587\u51fa\u5904\uff1a<a href=\"https:\/\/www.xttblog.com\">\u4e1a\u4f59\u8349<\/a>\uff1a &raquo; <a href=\"https:\/\/www.xttblog.com\/?p=3429\">\u8be6\u89e3 MongoDB \u4e2d\u7684\u7528\u6237\u89d2\u8272\u6743\u9650\u7684\u5206\u914d\u4e0e\u63a7\u5236<\/a><\/p><!-- <div class=\"bd-reward-stl\"><button id=\"bdRewardBtn\"><span><\/span><\/button><\/div> -->","protected":false},"excerpt":{"rendered":"<p>MongoDB \u4f5c\u4e3a\u4e00\u4e2a\u5206\u5e03\u5f0f\u6587\u4ef6\u5b58\u50a8\u7684\u6570\u636e\u5e93\u4f7f\u7528\u7684\u4eba\u8d8a\u6765\u8d8a\u591a\u3002\u5b83\u91cc\u9762\u5305\u542b\u5f88\u591a\u5185\u7f6e\u7684\u89d2\u8272\u548c\u6743\u9650\uff0c\u672c\u6587\u6765\u4ecb\u7ecd\u4e00\u4e0b [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[12,6],"tags":[1578,1577,747,656,394],"class_list":["post-3429","post","type-post","status-publish","format-standard","hentry","category-sql","category-yyzt","tag-mongodb","tag-nosql","tag-747","tag-656","tag-394"],"_links":{"self":[{"href":"https:\/\/www.xttblog.com\/index.php?rest_route=\/wp\/v2\/posts\/3429","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.xttblog.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.xttblog.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.xttblog.com\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.xttblog.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=3429"}],"version-history":[{"count":1,"href":"https:\/\/www.xttblog.com\/index.php?rest_route=\/wp\/v2\/posts\/3429\/revisions"}],"predecessor-version":[{"id":3430,"href":"https:\/\/www.xttblog.com\/index.php?rest_route=\/wp\/v2\/posts\/3429\/revisions\/3430"}],"wp:attachment":[{"href":"https:\/\/www.xttblog.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=3429"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.xttblog.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=3429"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.xttblog.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=3429"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}