【Mongodb】Mongodb常用查询命令总结

设计的集合的结构如下,下面将结合此集合结构和关系型数据库Oracle,总结Mongodb常用的查询命令
1.查询所有表中所有数据
<span class="pun" style="color: rgb(147, 161, 161);"><span style="color: rgb(0, 128, 128);">Mongodb</span>查询: </span><span class="kwd" style="color: rgb(30, 52, 123);">select</span><span class="pln" style="color: rgb(72, 72, 76);"> </span><span class="pun" style="color: rgb(147, 161, 161);">*</span><span class="pln" style="color: rgb(72, 72, 76);"> </span><span class="kwd" style="color: rgb(30, 52, 123);">from</span><span class="pln" style="color: rgb(72, 72, 76);"> lognLogBean</span><span class="pun" style="color: rgb(147, 161, 161);">;</span>
Oracle 查询: db.lognLogBean.find();
2.查询指定的列
<span class="typ" style="color: teal;">Oracle </span><span class="pun" style="color: rgb(147, 161, 161);">查询:</span><span class="pln" style="color: rgb(72, 72, 76);"> </span><span class="kwd" style="color: rgb(30, 52, 123);">select</span><span class="pln" style="color: rgb(72, 72, 76);"> l</span><span class="pun" style="color: rgb(147, 161, 161);">.</span><span class="pln" style="color: rgb(72, 72, 76);">userId</span><span class="pun" style="color: rgb(147, 161, 161);">,</span><span class="pln" style="color: rgb(72, 72, 76);">l</span><span class="pun" style="color: rgb(147, 161, 161);">.</span><span class="pln" style="color: rgb(72, 72, 76);">userName </span><span class="kwd" style="color: rgb(30, 52, 123);">from</span><span class="pln" style="color: rgb(72, 72, 76);"> lognLogBean l</span><span class="pun" style="color: rgb(147, 161, 161);">;</span>
<span class="typ" style="color: teal;">Mongodb</span><span class="pun" style="color: rgb(147, 161, 161);">查询: </span><span class="pln" style="color: rgb(72, 72, 76);">db</span><span class="pun" style="color: rgb(147, 161, 161);">.</span><span class="pln" style="color: rgb(72, 72, 76);">lognLogBean</span><span class="pun" style="color: rgb(147, 161, 161);">.</span><span class="pln" style="color: rgb(72, 72, 76);">find</span><span class="pun" style="color: rgb(147, 161, 161);">({},{</span><span class="str" style="color: rgb(221, 17, 68);">'userId'</span><span class="pun" style="color: rgb(147, 161, 161);">:</span><span class="lit" style="color: rgb(25, 95, 145);">1</span><span class="pun" style="color: rgb(147, 161, 161);">,</span><span class="str" style="color: rgb(221, 17, 68);">'userName'</span><span class="pun" style="color: rgb(147, 161, 161);">:</span><span class="lit" style="color: rgb(25, 95, 145);">1</span><span class="pun" style="color: rgb(147, 161, 161);">});</span>
备注:find中含有两个对象{},第一个对象表示查询条件,第二个对象表示显示过滤条件

3.查询指定的条目数,如查询100到300之前的数据
<span class="kwd" style="color: rgb(30, 52, 123);"><span style="color: rgb(147, 161, 161);"><span style="color: rgb(0, 128, 128);">Oracle </span>查询:</span>select</span><span class="pln" style="color: rgb(72, 72, 76);"> </span><span class="pun" style="color: rgb(147, 161, 161);">*</span><span class="pln" style="color: rgb(72, 72, 76);"> </span><span class="kwd" style="color: rgb(30, 52, 123);">from</span><span class="pun" style="color: rgb(147, 161, 161);">(</span><span class="pln" style="color: rgb(72, 72, 76);"> </span><span class="kwd" style="color: rgb(30, 52, 123);">select</span><span class="pln" style="color: rgb(72, 72, 76);"> t</span><span class="pun" style="color: rgb(147, 161, 161);">.*,</span><span class="pln" style="color: rgb(72, 72, 76);"> ROWNUM num </span><span class="kwd" style="color: rgb(30, 52, 123);">from</span><span class="pln" style="color: rgb(72, 72, 76);"> lognLogBean t </span><span class="pun" style="color: rgb(147, 161, 161);">)</span><span class="kwd" style="color: rgb(30, 52, 123);">where</span><span class="pln" style="color: rgb(72, 72, 76);"> num </span><span class="pun" style="color: rgb(147, 161, 161);">&gt;</span><span class="lit" style="color: rgb(25, 95, 145);">100</span><span class="pln" style="color: rgb(72, 72, 76);"> </span><span class="kwd" style="color: rgb(30, 52, 123);">and</span><span class="pln" style="color: rgb(72, 72, 76);"> num </span><span class="pun" style="color: rgb(147, 161, 161);">&lt;=</span><span class="lit" style="color: rgb(25, 95, 145);">300</span>
<span class="lit" style="color: rgb(25, 95, 145);"><span class="typ" style="color: teal;">Mongodb</span><span class="pun" style="color: rgb(147, 161, 161);">查询:db.lognLogBean.find().limit(200,100);</span> </span>
备注:limit中两个参数,第一个表示查询的条目数,第二个表示从哪一条开始查询

4.等于与不等于查询,1.查询用户ID为25002325的数据,2.查询用户ID不为25002325的数据
<span class="typ" style="color: teal;">Oracle</span><span class="pln" style="color: rgb(72, 72, 76);"> </span><span class="pun" style="color: rgb(147, 161, 161);">查询:</span><span class="kwd" style="color: rgb(30, 52, 123);">select</span><span class="pln" style="color: rgb(72, 72, 76);"> </span><span class="pun" style="color: rgb(147, 161, 161);">*</span><span class="pln" style="color: rgb(72, 72, 76);"> </span><span class="pln" style="color: rgb(72, 72, 76);">lognLogBean </span><span class="kwd" style="color: rgb(30, 52, 123);">where</span><span class="pln" style="color: rgb(72, 72, 76);"> userId = '25002325';</span>
<span class="typ" style="color: teal;">Mongodb</span><span class="pun" style="color: rgb(147, 161, 161);">查询:</span><span class="pln" style="color: rgb(72, 72, 76);">db</span><span class="pun" style="color: rgb(147, 161, 161);">.</span><span class="pln" style="color: rgb(72, 72, 76);">lognLogBean</span><span class="pun" style="color: rgb(147, 161, 161);">.</span><span class="pln" style="color: rgb(72, 72, 76);">find</span><span class="pun" style="color: rgb(147, 161, 161);">({'userId':'25002325'})</span><span class="pun" style="color: rgb(147, 161, 161);">;</span>
<span class="pun" style="color: rgb(147, 161, 161);"> </span>
<span class="pun" style="color: rgb(147, 161, 161);"><div class="linenums" style="color: rgb(30, 52, 123); margin-top: 0px; margin-bottom: 0px; padding-left: 0px; line-height: 14.615385055541992px;"><div class="L0" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;"><code class="language-sql" style="font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; word-wrap: break-word;"><span class="typ" style="color: teal;">Oracle</span><span class="pln" style="color: rgb(72, 72, 76);"> </span><span class="pun" style="color: rgb(147, 161, 161);">查询:</span><span class="kwd" style="color: rgb(30, 52, 123);">select</span><span class="pln" style="color: rgb(72, 72, 76);"> </span><span class="pun" style="color: rgb(147, 161, 161);">*</span><span class="pln" style="color: rgb(72, 72, 76);"> </span><span class="pln" style="color: rgb(72, 72, 76);">lognLogBean </span><span class="kwd" style="color: rgb(30, 52, 123);">where</span><span class="pln" style="color: rgb(72, 72, 76);"> userId != '25002325';</span>
<span class="pln" style="color: rgb(72, 72, 76);"><span class="typ" style="color: teal;">Oracle</span><span class="pln"> </span><span class="pun" style="color: rgb(147, 161, 161);">查询:</span><span class="kwd" style="color: rgb(30, 52, 123);">select</span><span class="pln"> </span><span class="pun" style="color: rgb(147, 161, 161);">*</span><span class="pln"> </span><span class="pln">lognLogBean </span><span class="kwd" style="color: rgb(30, 52, 123);">where</span><span class="pln"> userId &lt;&gt; '25002325';</span> </span>
<span class="typ" style="color: teal;">Mongodb</span><span class="pun" style="color: rgb(147, 161, 161);">查询:</span><span class="pln" style="color: rgb(72, 72, 76);">db</span><span class="pun" style="color: rgb(147, 161, 161);">.</span><span class="pln" style="color: rgb(72, 72, 76);">lognLogBean</span><span class="pun" style="color: rgb(147, 161, 161);">.</span><span class="pln" style="color: rgb(72, 72, 76);">find</span><span class="pun" style="color: rgb(147, 161, 161);">({'userId':{'$ne':'25002325'}})</span><span class="pun" style="color: rgb(147, 161, 161);">;</span>
5.含有and或者or的复合查询
<span class="typ" style="color: teal;">Oracle</span><span class="pln" style="color: rgb(72, 72, 76);"> </span><span class="pun" style="color: rgb(147, 161, 161);">查询:</span>select lognLogBean where userId = ‘25002325’ and unitId = ‘702DSGXT’;
<span class="typ" style="color: teal;">Mongodb</span><span class="pun" style="color: rgb(147, 161, 161);">查询:</span><span class="pln" style="color: rgb(72, 72, 76);">db</span><span class="pun" style="color: rgb(147, 161, 161);">.</span><span class="pln" style="color: rgb(72, 72, 76);">lognLogBean</span><span class="pun" style="color: rgb(147, 161, 161);">.</span><span class="pln" style="color: rgb(72, 72, 76);">find</span><span class="pun" style="color: rgb(147, 161, 161);">({</span><span class="str" style="color: rgb(221, 17, 68);">'<font color="#000000">userId</font>'</span><span class="pun" style="color: rgb(147, 161, 161);">:</span><span class="str" style="color: rgb(221, 17, 68);">'25002325',</span><span class="pun" style="color: rgb(147, 161, 161);">'<font color="#000000">unitId</font>':'<font color="#dd1144">702DGSXT</font>'});</span>
&nbsp;
`Oracle 查询:select lognLogBean where userId = ‘25002325’ or and unitId = ‘702DSGXT’;</div><div class="L4" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;">Mongodb查询:db.lognLogBean.find(‘$or’[{userId:‘25002325’},{‘unitId‘:’702DGSXT‘}]);</div></div></pre></div><div>6.含有大于等于小于的范围查询,($lt, $lte, $gt, $gte)如 1.查询jobLevel大于2小于4的用户信息, 2.查询<span style="font-size: 10.5pt; line-height: 1.5;">jobLevel大于等于2小于等于4的用户信息</span></div></div><div style="font-family: Arial;"><div><pre class="prettyprint linenums prettyprinted" style="font-size: 13px; font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; word-wrap: break-word; background-color: rgb(247, 247, 249); padding: 10px; border: 1px solid rgb(225, 225, 232); tab-size: 4; box-shadow: rgb(251, 251, 252) 40px 0px 0px inset, rgb(236, 236, 240) 41px 0px 0px inset;"><div class="linenums" style="color: rgb(30, 52, 123); margin-top: 0px; margin-bottom: 0px; padding-left: 0px;"><div class="L0" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;">Oracle 查询:select lognLogBean where jobLevel > 2 and jobLevel < 4;</div><div class="L1" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;">Mongodb查询:db.lognLogBean.find({jobLevel:{‘$gt’:’2’,’$lt’:’4’}});</div><div class="L1" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;">
</div><div class="L1" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;">
Oracle 查询:select lognLogBean where jobLevel >= 2 and jobLevel < =4;</div><div class="L1" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;">Mongodb查询:db.lognLogBean.find({jobLevel:{‘$gte’:’2’,’$lte’:’4’}});</div></div></span></code></div></div></pre></div><div>7.查询null或者'',查询remark为空的用户</div></div><div style="font-family: Arial;"><div><pre class="prettyprint linenums prettyprinted" style="font-size: 13px; font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; word-wrap: break-word; background-color: rgb(247, 247, 249); padding: 10px; border: 1px solid rgb(225, 225, 232); tab-size: 4; box-shadow: rgb(251, 251, 252) 40px 0px 0px inset, rgb(236, 236, 240) 41px 0px 0px inset;"><div class="linenums" style="color: rgb(30, 52, 123); margin-top: 0px; margin-bottom: 0px; padding-left: 0px;"><div class="L0" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;">Oracle 查询: select from lognLogBean where remark is null;</div><div class="L1" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;">Mongodb查询:db.lognLogBean.find(‘$or’[{‘remark’:null},{‘remark’:‘’}]);</div></div></pre></div><div>8.查询字段是否存在$exists,查询字段的类型$type </div><div><pre class="prettyprint linenums prettyprinted" style="font-size: 13px; font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; word-wrap: break-word; background-color: rgb(247, 247, 249); padding: 10px; border: 1px solid rgb(225, 225, 232); tab-size: 4; box-shadow: rgb(251, 251, 252) 40px 0px 0px inset, rgb(236, 236, 240) 41px 0px 0px inset;"><div class="linenums" style="color: rgb(30, 52, 123); margin-top: 0px; margin-bottom: 0px; padding-left: 0px;"><div class="L0" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;">Mongodb查询:db.lognLogBean.find({‘remark’:{$exists:true}}); //存在<span style="color: rgb(221, 17, 68);">remark就返回</span> </div><div class="L1" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;">Mongodb查询:db.lognLogBean.find({‘remark’:{$type:2}}); //如果remark是字符串就返回</div><div class="L1" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;">
</div><div class="L1" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;">
数据类型 Double  String  Object  Array   Binary data  Object id  Boolean  Date  Null  Regular expression  JavaScript code  Symbol  JavaScript code with scope  32-bit integer  Timestamp  64-bit integer  Min key  Max key
类型值     1            2         3          4         5                 7             8              9        10     11                            13                    14           15                                      16                  17                   18                255        127
</div></div></pre></div><div><span style="font-size: 10.5pt; line-height: 1.5;">9.模糊查询,1.查询用户名以‘王‘开始的用户,2.查询用户名中不以</span><span style="font-size: 10.5pt; line-height: 1.5;">‘王‘开始的用户,3,查询用户名中含有‘管理员’的用户,</span><span style="font-size: 10.5pt; line-height: 1.5; background-color: rgb(247, 247, 249);">4,查询</span><span style="background-color: rgb(247, 247, 249); font-size: small;">unitId</span><span style="font-size: 10.5pt; line-height: 1.5; background-color: rgb(247, 247, 249);">中含有‘</span><span style="background-color: rgb(247, 247, 249); color: rgb(147, 161, 161); font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 13.076923370361328px; line-height: 17.992788314819336px; white-space: pre;">SXT</span><span style="font-size: 10.5pt; line-height: 1.5; background-color: rgb(247, 247, 249);">’的用户,部分匹</span><span style="font-size: 10.5pt; line-height: 1.5; background-color: rgb(247, 247, 249);">配</span></div></div><div style="font-family: Arial;"><div><pre class="prettyprint linenums prettyprinted" style="font-size: 13px; font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; word-wrap: break-word; background-color: rgb(247, 247, 249); padding: 10px; border: 1px solid rgb(225, 225, 232); tab-size: 4; box-shadow: rgb(251, 251, 252) 40px 0px 0px inset, rgb(236, 236, 240) 41px 0px 0px inset;"><div class="linenums" style="color: rgb(30, 52, 123); margin-top: 0px; margin-bottom: 0px; padding-left: 0px;"><div class="L0" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;">1.<span style="color: rgb(0, 0, 0); font-family: Arial; font-size: 13.84615421295166px; line-height: 16.153846740722656px; white-space: normal;">查询用户名以‘王‘开始的用户</span></div><div class="L0" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;">Oracle 查询: select from lognLogBean where userName like ‘王%’</div><div class="L1" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;"><span class="typ" style="color: teal;">Mongodb</span><span class="pun" style="color: rgb(147, 161, 161);">查询:</span>db.lognLogBean.find({"<span style="color: rgb(221, 17, 68);">userName</span>":/^王/});</div><div class="L1" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;"> </div><div class="L1" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;"><span style="color: rgb(0, 0, 0); font-family: Arial; font-size: 13.84615421295166px; line-height: 16.153846740722656px; white-space: normal;">2.查询用户名中不以</span><span style="color: rgb(0, 0, 0); font-family: Arial; font-size: 10.5pt; line-height: 1.5; white-space: normal;">‘王‘开始的用户</span> </div></div><div class="linenums" style="color: rgb(30, 52, 123); margin-top: 0px; margin-bottom: 0px; padding-left: 0px;"><div class="L2" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;">Oracle 查询: <span class="kwd" style="color: rgb(30, 52, 123);">select</span><span class="pln" style="color: rgb(72, 72, 76);"> </span><span class="pun" style="color: rgb(147, 161, 161);">*</span><span class="pln" style="color: rgb(72, 72, 76);"> </span><span class="kwd" style="color: rgb(30, 52, 123);">from</span><span class="pln" style="color: rgb(72, 72, 76);"> lognLogBean </span><span class="kwd" style="color: rgb(30, 52, 123);">where</span><span class="pln" style="color: rgb(72, 72, 76);"> userName not like </span><span class="str" style="color: rgb(221, 17, 68);">'王%'</span></div><div class="L2" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;"><span class="str" style="color: rgb(221, 17, 68);"><font color="#000000"><span class="typ" style="color: teal;">Mongodb</span><span class="pun" style="color: rgb(147, 161, 161);">查询:</span>db.lognLogBean.find({"userName":{"$not":/^王/}},{"userName":1});</font> </span></div><div class="L2" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;"><span class="str" style="color: rgb(221, 17, 68);"><font color="#000000"> </font></span></div><div class="L2" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;"><span class="str" style="color: rgb(221, 17, 68);"><font color="#000000"><span style="font-family: Arial; font-size: 13.84615421295166px; line-height: 16.153846740722656px; white-space: normal;">3,查询用户名中含有‘管理员’的用户</span> </font></span></div><div class="L2" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;">Oracle 查询:<span class="kwd" style="color: rgb(30, 52, 123);">select</span><span class="pln" style="color: rgb(72, 72, 76);"> </span><span class="pun" style="color: rgb(147, 161, 161);">*</span><span class="pln" style="color: rgb(72, 72, 76);"> </span><span class="kwd" style="color: rgb(30, 52, 123);">from</span><span class="pln" style="color: rgb(72, 72, 76);"> lognLogBean </span><span class="kwd" style="color: rgb(30, 52, 123);">where</span><span class="pln" style="color: rgb(72, 72, 76);"> userName not like </span><span class="str" style="color: rgb(221, 17, 68);">'%管理员%'</span></div><div class="L2" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;">Mongodb查询:db.lognLogBean.find({‘userName’:{‘$regex’:‘管理员’}})
</div><div class="L2" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;">Mongodb查询:db.lognLogBean.find({‘userName’:/管理员/})
</div><div class="L2" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;">
</div><div class="L2" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;"><span style="white-space: normal; line-height: 16.153846740722656px; font-size: 13.84615421295166px; font-family: Arial; color: rgb(0, 0, 0);">4,查询<span style="font-size: small;">unitId</span>中含有‘<span style="color: rgb(147, 161, 161); font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 13.076923370361328px; line-height: 17.992788314819336px; white-space: pre;">SXT</span>’的用户,部分匹配</span> </div><div class="L2" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;"><span class="pln" style="color: rgb(0, 0, 0); font-size: 13.076923370361328px; line-height: 17.992788314819336px;"><span class="typ" style="color: teal;">Mongodb</span><span class="pun" style="color: rgb(147, 161, 161);">查询:</span>db</span><span class="pun" style="color: rgb(0, 0, 0); font-size: 13.076923370361328px; line-height: 17.992788314819336px;">.</span><span class="pln" style="color: rgb(0, 0, 0); font-size: 13.076923370361328px; line-height: 17.992788314819336px;">lognLogBean</span><span class="pun" style="color: rgb(0, 0, 0); font-size: 13.076923370361328px; line-height: 17.992788314819336px;">.</span><span class="pln" style="color: rgb(0, 0, 0); font-size: 13.076923370361328px; line-height: 17.992788314819336px;">find</span><span class="pun" style="color: rgb(0, 0, 0); font-size: 13.076923370361328px; line-height: 17.992788314819336px;">({</span><span class="str" style="color: rgb(0, 0, 0); font-size: 13.076923370361328px; line-height: 17.992788314819336px;">'<span style="font-family: Arial; font-size: small; line-height: 16.153846740722656px; white-space: normal;">unitId</span>'</span><span class="pun" style="color: rgb(0, 0, 0); font-size: 13.076923370361328px; line-height: 17.992788314819336px;">:</span>/<font color="#93a1a1"><span style="line-height: 17.980770111083984px;">sxt</span></font>/i<span class="pun" style="color: rgb(0, 0, 0); font-size: 13.076923370361328px; line-height: 17.992788314819336px;">}) //后面的/i表示不区分大小写</span><font color="#000000" face="Arial" size="2"><span style="line-height: 16.153846740722656px; white-space: normal;"> </span></font></div></div></pre></div><div>10.使用唯一distinct</div></div><div style="font-family: Arial;"><div><pre class="prettyprint linenums prettyprinted" style="font-size: 13px; font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; word-wrap: break-word; background-color: rgb(247, 247, 249); padding: 10px; border: 1px solid rgb(225, 225, 232); tab-size: 4; box-shadow: rgb(251, 251, 252) 40px 0px 0px inset, rgb(236, 236, 240) 41px 0px 0px inset;"><div class="linenums" style="color: rgb(30, 52, 123); margin-top: 0px; margin-bottom: 0px; padding-left: 0px;"><div class="L0" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;">Oracle 查询: select distinct(userName) from lognLogBean where userName like ‘王%’</div><div class="L1" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;">Mongodb查询:db.lognLogBean.distinct(‘userName’);</div></div></pre></div><div>11.常用函数count,mod 例子:1查找用户名中为'杨波'的总条目数,2.查出登录月份为偶数的用户</div></div><div style="font-family: Arial;"><div><pre class="prettyprint linenums prettyprinted" style="font-size: 13px; font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; word-wrap: break-word; background-color: rgb(247, 247, 249); padding: 10px; border: 1px solid rgb(225, 225, 232); tab-size: 4; box-shadow: rgb(251, 251, 252) 40px 0px 0px inset, rgb(236, 236, 240) 41px 0px 0px inset;"><div class="linenums" style="color: rgb(30, 52, 123); margin-top: 0px; margin-bottom: 0px; padding-left: 0px;"><div class="L0" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;">Oracle 查询: select count(userName) from lognLogBean where userName =杨波</div><div class="L1" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;">Mongodb查询:<span style="color: rgb(147, 161, 161);">db.lognLogBean.count({'userName':'杨波'});</span></div><div class="L1" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;"><span style="color: rgb(147, 161, 161);"> </span></div><div class="L1" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;"><div class="linenums" style="margin-top: 0px; margin-bottom: 0px; padding-left: 0px; line-height: 14.615385055541992px;"><div class="L0" style="line-height: 18px; padding-left: 0px; list-style-type: none;">Oracle 查询: select from lognLogBean where mod(month,2)=0;</div><div class="L1" style="line-height: 18px; padding-left: 0px; list-style-type: none;">Mongodb查询:<span style="color: rgb(147, 161, 161);">db.lognLogBean.find({'<span style="color: rgb(190, 190, 197);">month</span>':{$mod:[2,0]}}); //待验证? </span></div><div class="L1" style="line-height: 18px; padding-left: 0px; list-style-type: none;"><span style="color: rgb(147, 161, 161);">Mongodb查询:db.lognLogBean.find('this.<span style="color: rgb(190, 190, 197);">month%2==0'</span>); </span></div></div></div></div></pre></div><div>12.使用in,not in 进行查询 &nbsp;1.查询用户名中含有‘杨波’或者‘李燕’的用户,2.查询用户名中不含有‘杨波’或者'李燕'的用户</div></div><div style="font-family: Arial;"><div><pre class="prettyprint linenums prettyprinted" style="font-size: 13px; font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; word-wrap: break-word; background-color: rgb(247, 247, 249); padding: 10px; border: 1px solid rgb(225, 225, 232); tab-size: 4; box-shadow: rgb(251, 251, 252) 40px 0px 0px inset, rgb(236, 236, 240) 41px 0px 0px inset;"><div class="linenums" style="color: rgb(30, 52, 123); margin-top: 0px; margin-bottom: 0px; padding-left: 0px;"><div class="L0" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;">Oracle 查询: select from lognLogBean where userName in (‘杨波’,‘李燕’);</div><div class="L1" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;">Mongodb查询:db.lognLogBean.find({‘userName’:{‘$in’:[‘杨波’,‘李燕’]}});</div><div class="L1" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;">
</div><div class="L1" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;">
</div></div></pre></div><div>14.元操作符$not取反,如<span style="font-size: 10.5pt; line-height: 1.5;">查询</span><span style="font-size: 10.5pt; line-height: 1.5;">用户名中不含有‘杨波’</span> </div><div><pre class="prettyprint linenums prettyprinted" style="font-size: 13px; font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; word-wrap: break-word; background-color: rgb(247, 247, 249); padding: 10px; border: 1px solid rgb(225, 225, 232); tab-size: 4; box-shadow: rgb(251, 251, 252) 40px 0px 0px inset, rgb(236, 236, 240) 41px 0px 0px inset;"><div class="linenums" style="color: rgb(30, 52, 123); margin-top: 0px; margin-bottom: 0px; padding-left: 0px;"><div class="L0" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;">Oracle 查询: select * from lognLogBean where userName != ‘杨波’;
</div><div class="L0" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;">Mongodb查询:db.lognLogBean.find({‘userName’:{$not:{‘$eq’:‘杨波’}}});</div><div class="L0" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;">Mongodb查询:db.lognLogBean.find({‘userName’:{‘$ne’:‘杨波’}});
</div></div></pre></div><div>15.数组查询 Mongodb特有</div></div><div style="font-family: Arial;"><div><pre class="prettyprint linenums prettyprinted" style="font-size: 13px; font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; word-wrap: break-word; background-color: rgb(247, 247, 249); padding: 10px; border: 1px solid rgb(225, 225, 232); tab-size: 4; box-shadow: rgb(251, 251, 252) 40px 0px 0px inset, rgb(236, 236, 240) 41px 0px 0px inset;"><div class="linenums" style="color: rgb(30, 52, 123); margin-top: 0px; margin-bottom: 0px; padding-left: 0px;"><div class="L0" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;">为了进行下面的实验:数据中remark中的数据如下</div><div class="L1" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;"><font color="#48484c">{ "_id" : ObjectId("54d02a999e52a7a0287e930d"), "remark" : [ 2, 4, 8, 9 ] } { "_id" : ObjectId("54d02aa19e52a7a0287e930e"), "remark" : [ 6, 1, 2, 3 ] } </font></div><div class="L1" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;"><font color="#48484c">{ "_id" : ObjectId("54d02aab9e52a7a0287e930f"), "remark" : [ 4, 1, 0 ] }</font></div><div class="L0" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;">{ “_id” : ObjectId(“54ce3aed9e1e4c69aa9a744c”), “remark” : [ “test1”, “test2” ] }
{ “_id” : ObjectId(“54ce3bb49e1e4c69aa9a744d”), “remark” : [ “test1”, “test4” ] }
{ “_id” : ObjectId(“54cf148284b1157a30998c8d”), “remark” : [ “test1”, “test2”, “test3”, “test4” ] }
{ “_id” : ObjectId(“54cf14a084b1157a30998c8e”), “remark” : [ “test5”, “test2”, “test3”, “test1” ] }
</div><div class="L0" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;">
</div><div class="L0" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;">//查询remark字段中含有test1的用户,部分匹配即可查出,注意此处与顺序无关,只要字段数组中含有含有’test1’就会被检索出来</div><div class="L0" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;">db.lognLogBean.find({‘remark’:‘test1’}); </div><div class="L0" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;">Mongodb查询结果:
</div><div class="L1" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;"><span style="color: rgb(72, 72, 76);">{ "_id" : ObjectId("54ce3aed9e1e4c69aa9a744c"), "remark" : [ "test1", "test2" ] } { "_id" : ObjectId("54ce3bb49e1e4c69aa9a744d"), "remark" : [ "test1", "test4" ] } { "_id" : ObjectId("54cf148284b1157a30998c8d"), "remark" : [ "test1", "test2", "test3", "test4" ] } { "_id" : ObjectId("54cf14a084b1157a30998c8e"), "remark" : [ "test5", "test2", "test3", "test1" ] }</span></div><div class="L2" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;">
</div><div class="L2" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;">//查询remark字段中含有test1和test2的用户,需要完全匹配时用$all关键字,此处依然显示了顺序无关性,只要数组中同时含有’test1’,’test2’就会被检索出来</div><div class="L2" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;">db.lognLogBean.find({‘remark‘:{‘$all’:[‘test1’,’test2’]}}); </div><div class="L2" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;">Mongodb查询结果:
</div><div class="L2" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;"><font color="#93a1a1">{ "_id" : ObjectId("54ce3aed9e1e4c69aa9a744c"), "remark" : [ "test1", "test2" ] } { "_id" : ObjectId("54cf148284b1157a30998c8d"), "remark" : [ "test1", "test2", "test3", "test4" ] } { "_id" : ObjectId("54cf14a084b1157a30998c8e"), "remark" : [ "test5", "test2", "test3", "test1" ] }</font> </div><div class="L2" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;">
</div><div class="L2" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;">//查询remark字段中数组个数为2的用户,此时需要用到$size关键字,注意$size不能和大于($gt)小于($lt)一起用</div><div class="L2" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;">db.lognLogBean.find({‘remark‘:{‘$size’:2}}); 
</div><div class="L2" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;">Mongodb查询结果:
</div><div class="L2" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;"><font color="#93a1a1">{ "_id" : ObjectId("54ce3aed9e1e4c69aa9a744c"), "remark" : [ "test1", "test2" ] } { "_id" : ObjectId("54ce3bb49e1e4c69aa9a744d"), "remark" : [ "test1", "test4" ] }</font> </div><div class="L2" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;"><font color="#93a1a1"> </font></div><div class="L2" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;"><font color="#93a1a1">//运用字段中数组下标进行查询,如:查询remark字段中第二个地算为'test4'的用户,语句如下</font></div><div class="L2" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;"><font color="#93a1a1"><span class="pln" style="color: rgb(72, 72, 76);">db</span><span class="pun">.</span><span class="pln" style="color: rgb(72, 72, 76);">lognLogBean</span><span class="pun">.</span><span class="pln" style="color: rgb(72, 72, 76);">find</span><span class="pun">({</span><span class="str" style="color: rgb(221, 17, 68);">'remark.1'</span><span class="pun">:</span><span class="str" style="color: rgb(221, 17, 68);">'test4'</span><span class="pun">}); </span> </font></div><div class="L2" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;"><font color="#93a1a1"> </font></div><div class="L2" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;"><font color="#93a1a1">//通过slice获取数组中的部分数据</font></div><div class="L2" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;"><span class="pln" style="color: rgb(147, 161, 161);">db</span><span class="pun" style="color: rgb(147, 161, 161);">.</span><span class="pln" style="color: rgb(147, 161, 161);">lognLogBean</span><span class="pun" style="color: rgb(147, 161, 161);">.</span><span class="pln" style="color: rgb(147, 161, 161);">find</span><span class="pun" style="color: rgb(147, 161, 161);">({},{</span><span class="str" style="color: rgb(147, 161, 161);">'remark'</span><span class="pun" style="color: rgb(147, 161, 161);">:<font color="#dd1144">{$slice:2}</font></span><span class="pun" style="color: rgb(147, 161, 161);">}); //显示remark数组中前两个,考虑null与""的情况</span><font color="#93a1a1"> </font></div><div class="L2" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;"><span class="pun" style="color: rgb(147, 161, 161);"><span class="pln">db</span><span class="pun">.</span><span class="pln">lognLogBean</span><span class="pun">.</span><span class="pln">find</span><span class="pun">({},{</span><span class="str">'remark'</span><span class="pun">:<font color="#dd1144">{$slice:-2}</font></span><span class="pun">}); //显示</span></span><span style="color: rgb(147, 161, 161);">remark数组中后两个,</span><span style="color: rgb(147, 161, 161);">考虑null与""的情况</span></div><div class="L2" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;"><span style="color: rgb(147, 161, 161);"><span class="pln">db</span><span class="pun">.</span><span class="pln">lognLogBean</span><span class="pun">.</span><span class="pln">find</span><span class="pun">({},{</span><span class="str">'remark'</span><span class="pun">:<font color="#dd1144">{$slice:[1,2]}</font></span><span class="pun">}); //参数的含义 </span></span><font color="#93a1a1">[skip, limit] ,从哪开始截取,截取的个数</font></div><div class="L2" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;"><font color="#93a1a1">//</font><span style="background-color: rgb(245, 246, 247); color: rgb(34, 34, 34); line-height: 24px;">$elemMatch查询出,只有数组的元素至少有一个满足匹配的条件即被检索出来</span></div><div class="L2" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;"><span style="background-color: rgb(245, 246, 247); line-height: 24px;"><span class="pln" style="color: rgb(34, 34, 34); line-height: 17.992788314819336px; background-color: rgb(247, 247, 249);">db</span><span class="pun" style="color: rgb(34, 34, 34); line-height: 17.992788314819336px; background-color: rgb(247, 247, 249);">.</span><span class="pln" style="color: rgb(34, 34, 34); line-height: 17.992788314819336px; background-color: rgb(247, 247, 249);">lognLogBean</span><span class="pun" style="color: rgb(34, 34, 34); line-height: 17.992788314819336px; background-color: rgb(247, 247, 249);">.</span><span class="pln" style="color: rgb(34, 34, 34); line-height: 17.992788314819336px; background-color: rgb(247, 247, 249);">find</span><span class="pun" style="color: rgb(34, 34, 34); line-height: 17.992788314819336px; background-color: rgb(247, 247, 249);">({'<span style="color: rgb(221, 17, 68);">remark</span>':{'</span><span class="str" style="color: rgb(34, 34, 34); line-height: 17.992788314819336px; background-color: rgb(247, 247, 249);">$<span style="line-height: 23.990385055541992px; background-color: rgb(245, 246, 247);">elemMatch'</span></span><span class="pun" style="color: rgb(147, 161, 161); line-height: 17.992788314819336px; background-color: rgb(247, 247, 249);"><font color="#222222">:{</font><span class="nx" style="color: rgb(34, 34, 34); line-height: 24px; box-sizing: border-box;">$gt</span><span class="o" style="color: rgb(102, 102, 102); line-height: 24px; box-sizing: border-box;">:</span><span style="background-color: rgb(245, 246, 247); line-height: 24px; color: rgb(34, 34, 34);"> </span><span style="background-color: rgb(245, 246, 247); line-height: 24px;"><font color="#208050">1</font></span><span class="p" style="color: rgb(34, 34, 34); line-height: 24px; box-sizing: border-box;">,</span><span style="color: rgb(34, 34, 34); background-color: rgb(245, 246, 247); line-height: 24px;"> </span><span class="nx" style="color: rgb(34, 34, 34); line-height: 24px; box-sizing: border-box;">$lt</span><span class="o" style="color: rgb(102, 102, 102); line-height: 24px; box-sizing: border-box;">:</span><span style="color: rgb(34, 34, 34); background-color: rgb(245, 246, 247); line-height: 24px;"> </span><span style="background-color: rgb(245, 246, 247); line-height: 24px;"><font color="#208050">3</font></span></span></span><span class="pun" style="color: rgb(147, 161, 161);">}}}</span><span class="pun" style="color: rgb(147, 161, 161);">);&nbsp;</span></div><div class="L2" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;"><span class="pun" style="color: rgb(147, 161, 161);"><span class="typ" style="color: teal;">Mongodb</span><span class="pun">查询结果:</span> </span></div><div class="L2" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;"><span class="pun" style="color: rgb(147, 161, 161);">{ "_id" : ObjectId("54d02a999e52a7a0287e930d"), "remark" : [ 2, 4, 8, 9 ] } { "_id" : ObjectId("54d02aa19e52a7a0287e930e"), "remark" : [ 6, 1, 2, 3 ] }<font size="2"> </font></span></div><div class="L2" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;"><span class="pun" style="color: rgb(147, 161, 161);">//数组中存在以下情况,则被检索出来 一个元素大于5,另一个元素小于9 或者存在一个元素同时满足这两个条件</span></div><div class="L2" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;"><span class="pun" style="color: rgb(147, 161, 161);"><font color="#222222"><span style="line-height: 17.980770111083984px;">db.lognLogBean.find({'remark':{$gt: 5, $lt: 9}});</span></font> </span></div><div class="L2" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;"><span class="pun" style="color: rgb(147, 161, 161);"><font color="#222222"><span style="line-height: 17.980770111083984px;"><span class="typ" style="color: teal; line-height: 17.992788314819336px;">Mongodb</span><span class="pun" style="color: rgb(147, 161, 161); line-height: 17.992788314819336px;">查询结果:</span> </span></font></span></div><div class="L2" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;">{ "_id" : ObjectId("54d02a999e52a7a0287e930d"), "remark" : [ 2, 4, 8, 9 ] } { "_id" : ObjectId("54d02aa19e52a7a0287e930e"), "remark" : [ 6, 1, 2, 3 ] } </div></div></pre></div><div>16.字段中JSON查询,Mongodb特有</div></div><div style="font-family: Arial;"><div><pre class="prettyprint linenums prettyprinted" style="font-size: 13px; font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; word-wrap: break-word; background-color: rgb(247, 247, 249); padding: 10px; border: 1px solid rgb(225, 225, 232); tab-size: 4; box-shadow: rgb(251, 251, 252) 40px 0px 0px inset, rgb(236, 236, 240) 41px 0px 0px inset;"><div class="linenums" style="color: rgb(30, 52, 123); margin-top: 0px; margin-bottom: 0px; padding-left: 0px;"><div class="L0" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;">为了进行下面的实验:数据中remark中的数据如下
</div><div class="L1" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;"><font color="#48484c">{ "_id" : ObjectId("54d02a999e52a7a0287e930d"), "remark" : [ 2, 4, 8, 9 ] } { "_id" : ObjectId("54d02aa19e52a7a0287e930e"), "remark" : [ 6, 1, 2, 3 ] } </font></div><div class="L1" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;"><font color="#48484c">{ "_id" : ObjectId("54d02aab9e52a7a0287e930f"), "remark" : [ 4, 1, 0 ] }</font></div><div class="L0" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;">{ “_id” : ObjectId(“54cf472365668d263ae538ca”), “remark” : { “name” : “lisi”, “age” : 13, “test” : { “ww” : “ww”, “mm” : “mm” } } }</div><div class="L0" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;">{ “_id” : ObjectId(“54cf473a65668d263ae538cb”), “remark” : { “name” : “zhaojie”, “age” : 21, “test” : { “bb” : “bb”, “dd” : “dd” } } }</div><div class="L0" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;"><font color="#93a1a1">{ "_id" : ObjectId("54d06dadd19ef99ec18ac8ba"), "remark" : { "name" : "zhaojie", "age" : 23, "test" : [ { "cc" : 12 }, { "ff" : "ff" } ] } }</font> </div><div class="L0" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;"><font color="#93a1a1"> </font></div><div class="L0" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;"><font color="#93a1a1"> </font></div><div class="L0" style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 0px; list-style-type: none;">//查询`remark中name为’lisi’的用户信息
db.lognLogBean.find({‘remark.name’: ‘lisi’});
Mongodb查询结果:
{ “_id” : ObjectId(“54cf472365668d263ae538ca”), “remark” : { “name” : “lisi”, “age” : 13, “test” : { “ww” : “ww”, “mm” : “mm” } } }

//查询remark中test的bb为’bb’的用户信息
db.lognLogBean.find({‘remark.test.bb’: ‘bb’});
Mongodb查询结果:
{ “_id” : ObjectId(“54cf473a65668d263ae538cb”), “remark” : { “name” : “zhaojie”, “age” : 21, “test” : { “bb” : “bb”, “dd” : “dd” } } }

//json不支持部分查询
db.lognLogBean.find({“remark” :{ “name” : “zhaojie”, “age” : 21, “test” : { “bb” : “bb”, “dd” : “dd” }}}); //返回正确结果
db.lognLogBean.find({“remark” :{ “name” : “zhaojie”, “age” : 21}}); //无结果返回
//通过内嵌数组的序号查询
db.lognLogBean.find({“remark.test.0.cc” :12});
Mongodb查询结果:
{ “_id” : ObjectId(“54d06dadd19ef99ec18ac8ba”), “remark” : { “name” : “zhaojie”, “age” : 23, “test” : [ { “cc” : 12 }, { “ff” : “ff” } ] } }

至此:Mongodb的大体已经总结完全,如需更多,请参考Mongodb官网文档








your support will encourage me to continue to create!
版权声明:自由转载-非商用-非衍生-保持署名(创意共享3.0许可证)