锘??xml version="1.0" encoding="utf-8" standalone="yes"?>亚洲成AV人片在线观看,亚洲六月丁香婷婷综合,亚洲女同成人AⅤ人片在线观看http://www.tkk7.com/waterjava/category/48128.html闂婚亾鏈夊厛鍚庯紝鏈笟鏈変笓鏀伙紒zh-cnWed, 23 Mar 2011 06:47:10 GMTWed, 23 Mar 2011 06:47:10 GMT60mongo鏁版嵁搴撶殑涓嬭澆涓庡畨瑁咃紙windows xp鐜涓嬶級http://www.tkk7.com/waterjava/archive/2011/03/23/346832.html鐙肩埍涓婄嫺鐙肩埍涓婄嫺Wed, 23 Mar 2011 03:00:00 GMThttp://www.tkk7.com/waterjava/archive/2011/03/23/346832.htmlhttp://www.tkk7.com/waterjava/comments/346832.htmlhttp://www.tkk7.com/waterjava/archive/2011/03/23/346832.html#Feedback0http://www.tkk7.com/waterjava/comments/commentRss/346832.htmlhttp://www.tkk7.com/waterjava/services/trackbacks/346832.html1.涓嬭澆鏁版嵁搴?a style="color: #000000; text-decoration: none; outline-style: none; outline-width: initial; outline-color: initial; ">http://fastdl.mongodb.org/win32/mongodb-win32-i386-1.6.5.zip

2.鐜板湪瀹屾垚鍚庤В鍘嬬洰褰曪紝鏀懼埌C鐩樹笅錛岀劧鍚庢寜鐓у涓嬮夋嫨“鎴戠殑鐢?shù)鑴?>灞炴?>楂樼駭->鐜鍙橀噺”錛屽皢“C:\mongodb\bin”榪欎釜璺緞鏀懼埌鐜鍙橀噺鍐咃紙濡傛灉娣誨姞鐜鍙橀噺鍙互鍘葷綉涓婃壘錛?

3.閫夋嫨"寮濮?>榪愯"錛岃緭鍏?cmd"錛屽湪DOS紿楀彛鍐呰緭鍏?#8220;mongod -port 27017 -dbpath D:/deployment/mongoDb/data/db -logpath D:/deployment/mongoDb/data/log/logs.log ”錛屽叾涓璬bpath 涓烘暟鎹枃浠跺瓨鍌ㄨ礬寰勶紝logpath 涓烘棩蹇楁枃浠跺瓨鍌ㄨ礬寰勩?/p>

4.涓嶈鍏抽棴涓婇潰鐨勭獥鍙o紝鏂版墦寮涓涓狣OS錛岃緭鍏?#8220;mongo->use admin->db.AddUser(username,password)”,username:鏁版嵁搴撴暟鎹泦鐨勭敤鎴峰悕錛宲assword鏁版嵁搴撴暟鎹泦鎿嶄綔鐨勫瘑鐮併?/p>

5.鍦ㄤ袱涓狣OS紿楀彛鍐呭垎鍒寜“ctrl+c”錛屽湪絎竴涓狣OS紿楀彛鍐呰緭鍏?#8220;mongod -port 27017 -dbpath D:/deployment/mongoDb/data/db -logpath D:/deployment/mongoDb/data/log/logs.log -logappend -auth”鐨勫惎鍔ㄥ懡浠わ紝auth鏄姹傛搷浣滄暟鎹泦鏄渶瑕侀獙璇併?/p>

6.鍦ㄧ浜屼釜DOS紿楀彛鍐咃紝杈撳叆“mongo->use admin->db.auth(username,password)”錛岀劧鍚庡氨鍙互瀵規(guī)暟鎹泦榪涜鎿嶄綔錛堝銆佸垹銆佹敼錛夈?/p>


鏉ヨ嚜:http://www.hitb.com.cn/web/guest/bbs/-/message_boards/message/26944



鐙肩埍涓婄嫺 2011-03-23 11:00 鍙戣〃璇勮
]]>
win7 鍚姩 mongo 鏂規(guī)http://www.tkk7.com/waterjava/archive/2011/03/23/346822.html鐙肩埍涓婄嫺鐙肩埍涓婄嫺Wed, 23 Mar 2011 02:32:00 GMThttp://www.tkk7.com/waterjava/archive/2011/03/23/346822.htmlhttp://www.tkk7.com/waterjava/comments/346822.htmlhttp://www.tkk7.com/waterjava/archive/2011/03/23/346822.html#Feedback0http://www.tkk7.com/waterjava/comments/commentRss/346822.htmlhttp://www.tkk7.com/waterjava/services/trackbacks/346822.htmlhttp://www.360doc.com/content/10/0618/22/10626_33885376.shtml

鐙肩埍涓婄嫺 2011-03-23 10:32 鍙戣〃璇勮
]]>
mongo 鍛戒護闆?/title><link>http://www.tkk7.com/waterjava/archive/2011/03/23/346820.html</link><dc:creator>鐙肩埍涓婄嫺</dc:creator><author>鐙肩埍涓婄嫺</author><pubDate>Wed, 23 Mar 2011 02:31:00 GMT</pubDate><guid>http://www.tkk7.com/waterjava/archive/2011/03/23/346820.html</guid><wfw:comment>http://www.tkk7.com/waterjava/comments/346820.html</wfw:comment><comments>http://www.tkk7.com/waterjava/archive/2011/03/23/346820.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.tkk7.com/waterjava/comments/commentRss/346820.html</wfw:commentRss><trackback:ping>http://www.tkk7.com/waterjava/services/trackbacks/346820.html</trackback:ping><description><![CDATA[<span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; ">棣栧厛鍦╩ongo瀹樼綉涓嬭澆Windows鐨勭増鏈?/span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; "> </span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; "><br /> </span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; "><br /> </span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; ">鍚姩鏈嶅姟錛歮ongod.exe --port 12345 --dbpath=c:\mongodb\db</span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; "> </span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; "><br /> </span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; ">鏄劇ず涓涓嬩俊鎭細</span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; "> </span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; "><br /> </span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; ">Fri Dec 04 14:30:32 Mongo DB : starting : pid = 0 port = 12345 dbpath = c:\mongo</span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; "> </span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; "><br /> </span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; ">db\db master = 0 slave = 0  32-bit</span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; "> </span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; "><br /> </span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; "><br /> </span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; ">** NOTE: when using MongoDB 32 bit, you are limited to about 2 gigabytes of data</span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; "> </span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; "><br /> </span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; "><br /> </span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; ">**       see http://blog.mongodb.org/post/137788967/32-bit-limitations for more</span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; "> </span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; "><br /> </span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; "><br /> </span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; ">Fri Dec 04 14:30:32 db version v1.1.4-, pdfile version 4.5</span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; "> </span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; "><br /> </span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; ">Fri Dec 04 14:30:32 git version: c67c2f7dd681152f1784c8e1c2119b979e65881d</span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; "> </span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; "><br /> </span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; ">Fri Dec 04 14:30:32 sys info: windows (5, 1, 2600, 2, 'Service Pack 3') BOOST_LI</span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; "> </span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; "><br /> </span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; ">B_VERSION=1_35</span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; "> </span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; "><br /> </span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; ">Fri Dec 04 14:30:32 waiting for connections on port 12345</span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; "> </span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; "><br /> </span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; "><br /> </span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; "><br /> </span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; ">鍚姩瀹㈡埛绔細mongo.exe localhost:12345</span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; "> </span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; "><br /> </span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; "><br /> </span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; ">媯鏌ユ槸鍚︽甯?db.foo.save({a:1,b:9})</span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; "> </span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; "><br /> </span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; ">     db.foo.find({a:1})</span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; "> </span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; "><br /> </span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; ">鎺у埗鍙版樉紺猴細{ "_id" : ObjectId("4b18b5b56f40000000006cec"), "a" : 1, "b" : 9 }</span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; "> </span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; "><br /> </span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; "><br /> </span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; "><br /> </span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; ">娣誨姞鏁版嵁錛歞b.foo.save({a:1,b:9})</span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; "> </span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; "><br /> </span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; "><br /> </span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; ">鏌ヨ鏁版嵁錛歞b.foo.find({a:1})  //{a:1}鏄煡璇㈡潯浠訛紝褰撲負絀烘椂鏌ヨ鎵鏈?/span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; "> </span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; "><br /> </span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; ">  db.foo.findOne({a:1}) //鏄劇ず鍑轟竴鏉℃暟鎹?/span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; "> </span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; "><br /> </span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; "><br /> </span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; ">鍒犻櫎鏁版嵁錛歞b.foo.remove({a:1}) //鍒犻櫎a=1鐨勬暟鎹?/span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; "> </span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; "><br /> </span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; "><br /> </span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; ">琛ㄧ殑鏁版嵁閲?db.foo.find().count()</span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; "> </span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; "><br /> </span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; "><br /> </span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; ">鏄劇ず鏁版嵁鎸囧畾鐨勬潯鏁?db.foo.find().limit(n)</span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; "> </span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; "><br /> </span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; "><br /> </span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; ">鏄劇ず搴撳悕:db.foo.getDB()</span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; "> </span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; "><br /> </span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; "><br /> </span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; ">鑾峰彇绱㈠紩鍊鹼細db.foo.getIndexes()</span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; "> </span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; "><br /> </span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; "><br /> </span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; ">琛ㄧ殑緇熻:db.foo.stats()</span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; "> </span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; "><br /> </span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; "><br /> </span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; ">鍒犻櫎琛?db.foo.drop()</span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; "> </span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; "><br /> </span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; "><br /> </span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; ">鑾峰彇涓嶉噸澶嶇殑鍒楋細db.foo.distinct( key ) - eg. db.foo.distinct( 'x' )</span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; "> </span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; "><br /> </span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; "><br /> </span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; ">蹇界暐鍓嶉潰鐨勫嚑琛岋細db.other.find({a:2}).skip(2)//蹇界暐a=2涓殑鍓嶉潰2琛?/span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; "> </span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; "><br /> </span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; "><br /> </span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; ">鏂規(guī)硶甯姪:db.foo.help()</span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; "> </span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; "><br /> </span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; "><br /> </span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; "><br /> </span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; ">HELP</span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; "> </span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; "><br /> </span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; ">        show dbs                     show database names</span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; "> </span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; "><br /> </span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; ">        show collections             show collections in current database</span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; "> </span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; "><br /> </span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; ">        show users                   show users in current database</span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; "> </span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; "><br /> </span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; ">        show profile                 show most recent system.profile entries with time >= 1ms</span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; "> </span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; "><br /> </span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; ">        use <db name>                set curent database to <db name></span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; "> </span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; "><br /> </span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; ">        db.help()                    help on DB methods</span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; "> </span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; "><br /> </span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; ">        db.foo.help()                help on collection methods</span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; "> </span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; "><br /> </span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; ">        db.foo.find()                list objects in collection foo</span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; "> </span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; "><br /> </span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; ">        db.foo.find( { a : 1 } )     list objects in foo where a == 1</span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; "> </span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; "><br /> </span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; ">        it                           result of the last line evaluated; use to further iterate</span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; "> </span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; "><br /> </span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; "><br /> </span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; "><br /> </span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; ">DB methods:</span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; "> </span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; "><br /> </span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; ">        db.addUser(username, password)</span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; "> </span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; "><br /> </span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; ">        db.auth(username, password)</span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; "> </span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; "><br /> </span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; ">        db.cloneDatabase(fromhost)</span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; "> </span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; "><br /> </span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; ">        db.commandHelp(name) returns the help for the command</span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; "> </span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; "><br /> </span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; ">        db.copyDatabase(fromdb, todb, fromhost)</span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; "> </span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; "><br /> </span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; ">        db.createCollection(name, { size : ..., capped : ..., max : ... } )</span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; "> </span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; "><br /> </span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; ">        db.currentOp() displays the current operation in the db</span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; "> </span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; "><br /> </span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; ">        db.dropDatabase()</span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; "> </span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; "><br /> </span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; ">        db.eval(func, args) run code server-side</span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; "> </span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; "><br /> </span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; ">        db.getCollection(cname) same as db['cname'] or db.cname</span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; "> </span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; "><br /> </span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; ">        db.getCollectionNames()</span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; "> </span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; "><br /> </span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; ">        db.getLastError() - just returns the err msg string</span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; "> </span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; "><br /> </span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; ">        db.getLastErrorObj() - return full status object</span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; "> </span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; "><br /> </span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; ">        db.getMongo() get the server connection object</span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; "> </span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; "><br /> </span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; ">        db.getMongo().setSlaveOk() allow this connection to read from the nonmaster member of a replica pair</span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; "> </span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; "><br /> </span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; ">        db.getName()</span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; "> </span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; "><br /> </span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; ">        db.getPrevError()</span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; "> </span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; "><br /> </span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; ">        db.getProfilingLevel()</span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; "> </span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; "><br /> </span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; ">        db.getReplicationInfo()</span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; "> </span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; "><br /> </span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; ">        db.getSisterDB(name) get the db at the same server as this onew</span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; "> </span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; "><br /> </span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; ">        db.killOp() kills the current operation in the db</span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; "> </span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; "><br /> </span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; ">        db.printCollectionStats()</span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; "> </span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; "><br /> </span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; ">        db.printReplicationInfo()</span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; "> </span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; "><br /> </span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; ">        db.printSlaveReplicationInfo()</span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; "> </span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; "><br /> </span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; ">        db.printShardingStatus()</span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; "> </span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; "><br /> </span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; ">        db.removeUser(username)</span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; "> </span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; "><br /> </span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; ">        db.repairDatabase()</span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; "> </span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; "><br /> </span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; ">        db.resetError()</span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; "> </span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; "><br /> </span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; ">        db.runCommand(cmdObj) run a database command.  if cmdObj is a string, turns it into { cmdObj : 1 }</span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; "> </span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; "><br /> </span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; ">        db.setProfilingLevel(level) 0=off 1=slow 2=all</span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; "> </span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; "><br /> </span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; ">        db.shutdownServer()</span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; "> </span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; "><br /> </span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; ">        db.version() current version of the server</span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; "> </span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; "><br /> </span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; "><br /> </span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; ">DBCollection help</span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; "> </span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; "><br /> </span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; ">        db.foo.count()</span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; "> </span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; "><br /> </span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; ">        db.foo.dataSize()</span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; "> </span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; "><br /> </span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; ">        db.foo.distinct( key ) - eg. db.foo.distinct( 'x' )</span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; "> </span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; "><br /> </span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; ">        db.foo.drop() drop the collection</span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; "> </span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; "><br /> </span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; ">        db.foo.dropIndex(name)</span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; "> </span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; "><br /> </span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; ">        db.foo.dropIndexes()</span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; "> </span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; "><br /> </span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; ">        db.foo.ensureIndex(keypattern,options) - options should be an object with these possible fields: name, unique, dropDups</span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; "> </span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; "><br /> </span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; ">        db.foo.find( [query] , [fields]) - first parameter is an optional queryfilter. second parameter is optional set of fields to return.  e.g. db.foo.find( { x : 77 } , { name : 1 , x : 1 } )</span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; "> </span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; "><br /> </span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; ">        db.foo.find(...).count()</span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; "> </span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; "><br /> </span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; ">        db.foo.find(...).limit(n)</span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; "> </span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; "><br /> </span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; ">        db.foo.find(...).skip(n)</span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; "> </span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; "><br /> </span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; ">        db.foo.find(...).sort(...)</span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; "> </span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; "><br /> </span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; ">        db.foo.findOne([query])</span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; "> </span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; "><br /> </span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; ">        db.foo.getDB() get DB object associated with collection</span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; "> </span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; "><br /> </span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; ">        db.foo.getIndexes()</span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; "> </span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; "><br /> </span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; ">        db.foo.group( { key : ..., initial: ..., reduce : ...[, cond: ...] } )</span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; "> </span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; "><br /> </span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; ">        db.foo.mapReduce( mapFunction , reduceFunction , <optional params> )</span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; "> </span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; "><br /> </span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; ">        db.foo.remove(query)</span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; "> </span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; "><br /> </span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; ">        db.foo.renameCollection( newName ) renames the collection</span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; "> </span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; "><br /> </span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; ">        db.foo.save(obj)</span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; "> </span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; "><br /> </span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; ">        db.foo.stats()</span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; "> </span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; "><br /> </span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; ">        db.foo.storageSize() - includes free space allocated to this collection</span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; "> </span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; "><br /> </span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; ">        db.foo.totalIndexSize() - size in bytes of all the indexes</span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; "> </span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; "><br /> </span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; ">        db.foo.totalSize() - storage allocated for all data and indexes</span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; "> </span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; "><br /> </span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; ">        db.foo.update(query, object[, upsert_bool])</span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; "> </span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; "><br /> </span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; ">        db.foo.validate() - SLOW</span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; "> </span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; "><br /> </span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; ">        db.foo.getShardVersion() - only for use with sharding</span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; "> </span> <div><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; "><br /> </span></div> <div><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; ">鏉ヨ嚜: </span><a >http://canofy.javaeye.com/blog/540926</a></div> <img src ="http://www.tkk7.com/waterjava/aggbug/346820.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.tkk7.com/waterjava/" target="_blank">鐙肩埍涓婄嫺</a> 2011-03-23 10:31 <a href="http://www.tkk7.com/waterjava/archive/2011/03/23/346820.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣〃璇勮</a></div>]]></description></item><item><title>mongo shell鍛戒護http://www.tkk7.com/waterjava/archive/2011/03/23/346819.html鐙肩埍涓婄嫺鐙肩埍涓婄嫺Wed, 23 Mar 2011 02:29:00 GMThttp://www.tkk7.com/waterjava/archive/2011/03/23/346819.htmlhttp://www.tkk7.com/waterjava/comments/346819.htmlhttp://www.tkk7.com/waterjava/archive/2011/03/23/346819.html#Feedback0http://www.tkk7.com/waterjava/comments/commentRss/346819.htmlhttp://www.tkk7.com/waterjava/services/trackbacks/346819.html鍛戒護琛?/h3>
--help 鏄劇ず鍛戒護琛屽弬鏁?/td>
--nodb 涓嶈繛鎺ユ暟鎹簱鏂瑰紡鍚姩錛岀◢鍚庡彲浠ヤ嬌鐢?nbsp;new Mongo() 鎴?nbsp;connect() 鏉ュ緩绔嬭繛鎺?/td>
--shell 浠庡懡浠よ榪愯瀹屼竴涓?.js 鏂囦歡鍚庯紝鍋滅暀鍦╯hell涓紝鑰屼笉鏄粨鏉?/td>

鐗規(guī)畩鍛戒護

闈濲avaScript鐨勮緟鍔╂寚浠わ細

help 鏄劇ず甯姪
db.help() 鏄劇ず db 鏂規(guī)硶甯姪
db.myColl .help() 鏄劇ず鑱氶泦鐨勬柟娉曞府鍔?/td>
show dbs 鎵撳嵃鏈嶅姟鍣ㄤ笂鎵鏈夋暟鎹簱鐨勫垪琛?/td>
use dbname 璁劇疆db鍙橀噺鏉ユ寚鏄庝嬌鐢ㄦ湇鍔″櫒涓婄殑 dbname 鏁版嵁搴?/td>
show collections 鎵撳嵃褰撳墠鏁版嵁搴撶殑鎵鏈夎仛闆?/td>
show users 鎵撳嵃褰撳墠鏁版嵁搴撶殑鐢ㄦ埛
show profile 鎵撳嵃鏈榪戣楁椂澶т簬1ms鐨刾rofiling鎿嶄綔

鍩烘湰鐨凷hell Javascript鎿嶄綔

db 鎸囧悜褰撳墠鏁版嵁搴撳璞″拰榪炴帴鐨勫彉閲忥紝宸茬粡鍦ㄤ綘鐨勫疄渚嬮噷瀹氫箟濂姐?/td>
db.auth(user,pass) 鏁版嵁搴撹璇侊紙濡傛灉榪愯瀹夊叏妯″紡鐨勮瘽錛?/td>
coll = db.collection 璁塊棶鏁版嵁搴撻噷鐗瑰畾鐨?nbsp;collection
cursor = coll.find() 鏌ユ壘鑱氶泦閲屾墍鏈夌殑瀵硅薄銆傚弬鑰?nbsp;[鏌ヨ] 銆?/td>
coll.remove(objpattern ) 浠庤仛闆嗛噷鍒犻櫎鍖歸厤鐨勫璞°?nbsp;
objpattern 鏄竴涓寚瀹氬尮閰嶇殑鍩熺殑瀵硅薄錛屼緥濡傦細coll.remove( { name: "Joe" } );
coll.save(object ) 鍦ㄨ仛闆嗕腑淇濆瓨瀵硅薄錛屽鏋滃凡緇忓瓨鍦ㄧ殑璇濆垯鏇存柊瀹冦?nbsp;
濡傛灉瀵硅薄鏈?presave 鏂規(guī)硶錛屽垯浼氬湪淇濆瓨鍒版暟鎹簱涔嬪墠錛堟彃鍏ュ拰鏇存柊涔嬪墠錛夎皟鐢ㄨ鏂規(guī)硶銆?/td>
coll.insert(object) 鍚戣仛闆嗕腑鎻掑叆瀵硅薄銆備笉浼氭鏌ヨ瀵硅薄鏄惁宸茬粡瀛樺湪鑱氶泦涓紙鍗籌紝涓嶆槸 upsert錛?/td>
coll.update(...) 鍦ㄨ仛闆嗕腑鏇存柊瀵硅薄銆倁pdate() 鏈夎澶氬弬鏁幫紝璇鋒煡鐪?nbsp;鏇存柊 鏂囨。銆?/td>
coll.ensureIndex( { name : 1 } ) 瀵?nbsp;name 寤虹儲寮曘傚鏋滅儲寮曞瓨鍦ㄥ垯涓嶅仛浠諱綍浜嬨?/td>
coll.drop() 鍒犻櫎 coll 鑱氶泦
db.getSisterDB(name) 榪斿洖褰撳墠榪炴帴鐨勫彟涓涓暟鎹簱銆傚畠鍏佽璺ㄦ暟鎹簱鏌ヨ錛屼緥濡傦細db.getSisterDB('production').getCollectionNames()

鏌ヨ

coll.find() 鏌ヨ鎵鏈夋枃妗?/td>
it 寰幆涓婃 find() 璋冪敤榪斿洖鐨勬父鏍?/td>
coll.find( criteria ); 鏌ヨ鑱氶泦涓尮閰?nbsp;criteria 鐨勫璞°備緥濡傦細coll.find( { name: "Joe" } );
coll.findOne( criteria); 鏌ヨ騫惰繑鍥炰竴涓璞°傚鏋滄病鏈夋壘鍒板垯榪斿洖 null銆傚鏋滀綘鍙渶瑕佽繑鍥炰竴涓璞★紝榪欎釜鏂規(guī)硶姣?nbsp;find() as limit(1) 鏁堢巼鏇撮珮銆傚鏋滃厓绱犵被鍨嬫槸瀛楃涓詫紝鏁板瓧鎴栨椂闂達紝浣犺繕鍙互浣跨敤姝e垯琛ㄨ揪寮忥細coll.find( { name: /joe/i } );
coll.find( criteria, fields ); 鏌ヨ瀵硅薄閲岀壒瀹氱殑鍩熴備緥濡傦細coll.find( {}, {name:true} );
coll.find().sort( {field :1[, field :1] }); 瀵硅繑鍥炵粨鏋滆繘琛屾帓搴忥紙field ASC錛夈備嬌鐢?-1 琛ㄧず DESC銆?/td>
coll.find( criteria ).sort( { field : 1 } ) 鏌ユ壘鍖歸厤 criteria 鐨勫璞★紝騫跺 field 榪涜鎺掑簭銆?/td>
coll.find( ... ).limit(n ) 闄愬埗緇撴灉榪斿洖 n 琛屻傚鏋滀綘鍙渶瑕佹煇鍑犺鏁版嵁錛屾帹鑽愯繖鏍峰仛鏉ヨ幏寰楁渶浼樻ц兘銆?/td>
coll.find( ... ).skip(n) 璺寵繃 n 琛岀粨鏋溿?/td>
coll.count() 榪斿洖鑱氶泦閲屽璞$殑鎬繪暟銆?/td>
coll.find( ... ).count() 榪斿洖鍖歸厤璇ユ煡璇㈢殑瀵硅薄鎬繪暟銆傛敞鎰忥紝璇ヨ繑鍥炰細蹇界暐 limit 鍜?skip銆傛瘮濡傛湁100琛岃褰曞尮閰嶈鏌ヨ錛屼絾鏄痩imit涓?0錛?tt>count() 浠嶄細榪斿洖100銆傝繖姣斾綘鑷繁寰幆鏇村揩錛屼絾浠嶇劧闇瑕佹秷鑰椾簺鏃墮棿銆?/td>

鏇村淇℃伅璇峰弬鑰?nbsp;[鏌ヨ] 銆?/p>

閿欒媯鏌?/h3>
[{{db.getLastError()}}] 榪斿洖涓婃鎿嶄綔鐨勯敊璇?/td>
db.getPrevError() 榪斿洖涔嬪墠鎿嶄綔鐨勯敊璇?/td>
db.resetError() 娓呴櫎閿欒璁板綍

綆$悊鍛戒護

db.cloneDatabase(fromhost) 浠庡彟澶栨寚瀹氱殑涓繪満鎷瘋礉褰撳墠鏁版嵁鏁版嵁搴撱俧romhost蹇呴』涓簄oauth妯″紡銆?/td>
db.copyDatabase(fromdb, todb, fromhost) 鎷瘋礉fromhost鐨刦romdb鏁版嵁搴撳埌褰撳墠鏈嶅姟鍣ㄧ殑todb鏁版嵁搴撱俧romhost蹇呴』涓簄oauth妯″紡銆?/td>
db.repairDatabase() 淇褰撳墠鏁版嵁搴撱傚鏋滄暟鎹簱寰堝ぇ鍒欒鎿嶄綔浼氶潪甯告參銆?/td>
db.addUser(user,pwd) 緇欏綋鍓嶆暟鎹簱娣誨姞鐢ㄦ埛銆?/td>
db.getCollectionNames() 鑾峰緱鎵鏈夎仛闆嗙殑鍒楄〃銆?/td>
db.dropDatabase() 鍒犻櫎褰撳墠鏁版嵁搴撱?/td>

鎵撳紑棰濆榪炴帴

db = connect("<host>:<port>/<dbname>") 鎵撳紑涓涓柊鐨勬暟鎹簱榪炴帴銆備竴涓猻hell鍙兘鏈夊涓繛鎺ワ紝浣嗘槸shell鑷姩鐨刧etLastError鍙敤浜?'db' 鍙橀噺銆?/td>
conn = new Mongo("hostname") 鎵撳紑涓涓柊鐨勬湇鍔″櫒榪炴帴銆傜劧鍚庡彲浠ヤ嬌鐢?nbsp;getDB() 鏉ラ夋嫨涓涓暟鎹簱銆?/td>
db = conn.getDB("dbname") 瀵逛竴涓繛鎺ラ夋嫨涓涓壒瀹氱殑鏁版嵁搴撱?/td>

鍏朵粬

Object.bsonsize(db.foo.findOne()) 鎵撳嵃涓涓暟鎹簱瀵硅薄鐨刡son澶у皬錛坢ongo 鐗堟湰1.3鍙婁互涓婏級
db.foo.findOne().bsonsize() 鎵撳嵃涓涓暟鎹簱瀵硅薄鐨刡son澶у皬 (mongo 鐗堟湰1.3涔嬪墠)



鐙肩埍涓婄嫺 2011-03-23 10:29 鍙戣〃璇勮
]]>
mongo phpadmin瀹㈡埛绔?/title><link>http://www.tkk7.com/waterjava/archive/2011/03/23/346817.html</link><dc:creator>鐙肩埍涓婄嫺</dc:creator><author>鐙肩埍涓婄嫺</author><pubDate>Wed, 23 Mar 2011 02:28:00 GMT</pubDate><guid>http://www.tkk7.com/waterjava/archive/2011/03/23/346817.html</guid><wfw:comment>http://www.tkk7.com/waterjava/comments/346817.html</wfw:comment><comments>http://www.tkk7.com/waterjava/archive/2011/03/23/346817.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.tkk7.com/waterjava/comments/commentRss/346817.html</wfw:commentRss><trackback:ping>http://www.tkk7.com/waterjava/services/trackbacks/346817.html</trackback:ping><description><![CDATA[<span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; ">鍏跺疄鐢╩ongo宸茬粡鏈変簺鏃跺欎簡錛屼箣鎵浠ョ畻鍒濇帰錛屾槸鍥犱負鐢ㄧ殑涓嶆繁鍏ワ紝涓昏灝辨槸褰撲腑nosql涓殑綾籯-v鐢ㄧ殑錛岀敤涔嬪彇浠d簡閮ㄥ垎鐨則t錛屽師鍥犲緢綆鍗曪紝mongo涓殑鏁版嵁鏍煎紡铏界劧鏄痓son鐨勶紝涓嶈繃鍦ㄦ垜榪欎釜pythoner鐪間腑錛岃繖涓嶆槑鏄庡氨鏄函澶╃劧鐨?dict涔堬紒濂藉惂錛屾垜鎵胯錛屽氨鏄繖涓師鍥犺鎴戜箟鏃犲弽欏懼湴璧頒笂浜唌ongoing涔嬭礬(鏃犺浠涔堥」鐩紝鐢ㄥ埌瀛樺偍鑷劧鑰岀劧鐨勬兂鐢╩ongo)銆?/span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; "> </span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; "><br /> </span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; ">mongo鐨勪紭鍔f槸鍦ㄤ嬌鐢ㄧ殑榪囩▼涓愭浣撻獙鍑烘潵鐨勶紝鍦ㄨ繖閲屽氨涓嶈瘎璇翠簡錛屾兂瑕佽瘎嫻嬬殑璇風(fēng)洿鎺oogle涔?/span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; "><img src="http://iyuan.javaeye.com/images/smiles/icon_wink.gif" style="border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; " alt="" /></span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; "> </span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; "><br /> </span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; "><br /> </span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; ">涔嬪墠涓鐩存槸鐩存帴鍦ㄦ湇鍔″櫒绔敤pymongo鎴栬卪ongo鑷甫鐨剆hell鍋氭暟鎹煡鐪嬩慨鏀逛箣綾葷殑鎿嶄綔錛岀獊鐒跺彂鐜拌繖涓疄鍦ㄤ笉鍒╀簬鎺ㄥ箍錛屽叕鍙稿悓浜嬩技涔庢湰鑳界殑瀵硅繖縐峮osql鏈夌ǔ瀹氭т笂鐨勬鐤戙備篃濂界悊瑙o紝鐪嬩笉鍒扮殑錛岄氬父鏄笉鍙俊鐨?璋佽鐨勬潵鐫)銆?/span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; "> </span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; "><br /> </span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; "><br /> </span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; ">閴翠簬澶т紮閮戒範鎯簡phpadmin鐜﹎ysql鐨勫厜鑽d紶緇燂紝濡傛灉mongo涔熸湁綾諱技鐨勪笢涓滐紝鐪嬭搗鏉ヤ篃浜插垏浜涳紝涓漢鎰熻瀵規(guī)帹騫夸篃浼氭湁鍒╀簺銆?/span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; "> </span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; "><br /> </span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; "><br /> </span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; ">棰濓紝璇翠簡榪欎箞澶氾紝濂藉儚榪樻病鏈夎兘榪涘叆鍒頒富棰橈紝濂藉惂錛岃鏄垵鎺紝浼間箮鏈変簺鏍囬鍏氫簡錛屽叾瀹炲氨鎯蟲帹鑽愪笅榪欎釜涓滀笢錛?/span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; "><a target="_blank" style="color: #108ac6; text-decoration: underline; ">http://code.google.com/p/rock-php/wiki/rock_mongo_zh#瀹夎</a></span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; "> </span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; "><br /> </span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; "><br /> </span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; ">涓嶉敊鐨刴ongodb phpadmin瀹㈡埛绔紝榪樻敮鎸佷腑鏂?鎴戞兂榪欎釜榪樻槸铔湁鍒╂帹騫跨殑)錛屾墍璋撳垵鎺紝鍙笉榪囨槸浣跨敤榪欎笢涓滄崲浜嗕釜瑙嗚鏉ョ湅鐪婱ongodb,鎰熻鐨勭‘鏈変簺涓嶄竴鏍楓?/span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; "> </span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; "><br /> </span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; "><br /> </span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; ">涓嶈繃錛屽煎緱娉ㄦ剰鍒版槸錛岃榪欑帺鎰忎箣鍓嶏紝榪樺緱涓簆hp瑁呬竴涓猰ongo鐨刣rive錛屼笉榪囦笉瑕佺揣錛岃瀹岃繖涓箣鍚庯紝璁塊棶鏃朵細鐩存帴緇欎釜瑁卍rive鐨勯摼鎺ワ紝榪樻槸铔柟渚跨殑銆?/span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; "> </span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; "><br /> </span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; "><br /> </span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; ">棰濓紝鎴戝簲璇ヤ笉綆楁爣棰樺厷鍚э紙鑷沖皯涓嶆槸綰鐨勬爣棰樺厷銆傘?/span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; "><img src="http://iyuan.javaeye.com/images/smiles/icon_biggrin.gif" style="border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; " alt="" /></span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; "> </span><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; ">錛?/span> <div><span style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; ">鏉ヨ嚜:</span><a >http://iyuan.javaeye.com/blog/799515</a></div> <img src ="http://www.tkk7.com/waterjava/aggbug/346817.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.tkk7.com/waterjava/" target="_blank">鐙肩埍涓婄嫺</a> 2011-03-23 10:28 <a href="http://www.tkk7.com/waterjava/archive/2011/03/23/346817.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣〃璇勮</a></div>]]></description></item><item><title>mongo甯哥敤鎿嶄綔http://www.tkk7.com/waterjava/archive/2011/03/23/346816.html鐙肩埍涓婄嫺鐙肩埍涓婄嫺Wed, 23 Mar 2011 02:26:00 GMThttp://www.tkk7.com/waterjava/archive/2011/03/23/346816.htmlhttp://www.tkk7.com/waterjava/comments/346816.htmlhttp://www.tkk7.com/waterjava/archive/2011/03/23/346816.html#Feedback0http://www.tkk7.com/waterjava/comments/commentRss/346816.htmlhttp://www.tkk7.com/waterjava/services/trackbacks/346816.htmlshell#鏌ヨ
鏌ヨ name = "bruce" 鐨勬暟鎹?br style="line-height: normal; " /> db.users.find({ name : "bruce" });

鏉′歡鎿嶄綔絎?br style="line-height: normal; " /> $gt : >
$lt : <
$gte: >=
$lte: <=
$ne : !=銆?lt;>
$in : in
$nin: not in
$all: all
$not: 鍙嶅尮閰?1.3.3鍙婁互涓婄増鏈?

鏌ヨ name <> "bruce" and age >= 18 鐨勬暟鎹?br style="line-height: normal; " /> db.users.find({name: {$ne: "bruce"}, age: {$gte: 18}});

鏌ヨ creation_date > '2010-01-01' and creation_date <= '2010-12-31' 鐨勬暟鎹?br style="line-height: normal; " /> db.users.find({creation_date:{$gt:new Date(2010,0,1), $lte:new Date(2010,11,31)});

鏌ヨ age in (20,22,24,26) 鐨勬暟鎹?br style="line-height: normal; " /> db.users.find({age: {$in: [20,22,24,26]}});

鏌ヨ age鍙栨ā10絳変簬0 鐨勬暟鎹?br style="line-height: normal; " /> db.users.find('this.age % 10 == 0');
鎴栬?br style="line-height: normal; " /> db.users.find({age : {$mod : [10, 0]}});

鍖歸厤鎵鏈?br style="line-height: normal; " /> db.users.find({favorite_number : {$all : [6, 8]}});
鍙互鏌ヨ鍑簕name: 'David', age: 26, favorite_number: [ 6, 8, 9 ] }
鍙互涓嶆煡璇㈠嚭{name: 'David', age: 26, favorite_number: [ 6, 7, 9 ] }

鏌ヨ涓嶅尮閰峮ame=B*甯﹀ご鐨勮褰?br style="line-height: normal; " /> db.users.find({name: {$not: /^B.*/}});
鏌ヨ age鍙栨ā10涓嶇瓑浜? 鐨勬暟鎹?br style="line-height: normal; " /> db.users.find({age : {$not: {$mod : [10, 0]}}});

#榪斿洖閮ㄥ垎瀛楁
閫夋嫨榪斿洖age鍜宊id瀛楁(_id瀛楁鎬繪槸浼氳榪斿洖)
db.users.find({}, {age:1});
db.users.find({}, {age:3});
db.users.find({}, {age:true});
db.users.find({ name : "bruce" }, {age:1});
0涓篺alse, 闈?涓簍rue

閫夋嫨榪斿洖age銆乤ddress鍜宊id瀛楁
db.users.find({ name : "bruce" }, {age:1, address:1});

鎺掗櫎榪斿洖age銆乤ddress鍜宊id瀛楁
db.users.find({}, {age:0, address:false});
db.users.find({ name : "bruce" }, {age:0, address:false});

鏁扮粍鍏冪礌涓暟鍒ゆ柇
瀵逛簬{name: 'David', age: 26, favorite_number: [ 6, 7, 9 ] }璁板綍
鍖歸厤db.users.find({favorite_number: {$size: 3}});
涓嶅尮閰峝b.users.find({favorite_number: {$size: 2}});

$exists鍒ゆ柇瀛楁鏄惁瀛樺湪
鏌ヨ鎵鏈夊瓨鍦╪ame瀛楁鐨勮褰?br style="line-height: normal; " /> db.users.find({name: {$exists: true}});
鏌ヨ鎵鏈変笉瀛樺湪phone瀛楁鐨勮褰?br style="line-height: normal; " /> db.users.find({phone: {$exists: false}});

$type鍒ゆ柇瀛楁綾誨瀷
鏌ヨ鎵鏈塶ame瀛楁鏄瓧絎︾被鍨嬬殑
db.users.find({name: {$type: 2}});
鏌ヨ鎵鏈塧ge瀛楁鏄暣鍨嬬殑
db.users.find({age: {$type: 16}});

瀵逛簬瀛楃瀛楁錛屽彲浠ヤ嬌鐢ㄦ鍒欒〃杈懼紡
鏌ヨ浠ュ瓧姣峛鎴栬匓甯﹀ご鐨勬墍鏈夎褰?br style="line-height: normal; " /> db.users.find({name: /^b.*/i});

$elemMatch(1.3.1鍙婁互涓婄増鏈?
涓烘暟緇勭殑瀛楁涓尮閰嶅叾涓煇涓厓绱?/p>

Javascript鏌ヨ鍜?where鏌ヨ
鏌ヨ age > 18 鐨勮褰曪紝浠ヤ笅鏌ヨ閮戒竴鏍?br style="line-height: normal; " /> db.users.find({age: {$gt: 18}});
db.users.find({$where: "this.age > 18"});
db.users.find("this.age > 18");
f = function() {return this.age > 18} db.users.find(f);

鎺掑簭sort()
浠ュ勾榫勫崌搴廰sc
db.users.find().sort({age: 1});
浠ュ勾榫勯檷搴廳esc
db.users.find().sort({age: -1});

闄愬埗榪斿洖璁板綍鏁伴噺limit()
榪斿洖5鏉¤褰?br style="line-height: normal; " /> db.users.find().limit(5);
榪斿洖3鏉¤褰曞茍鎵撳嵃淇℃伅
db.users.find().limit(3).forEach(function(user) {print('my age is ' + user.age)});
緇撴灉
my age is 18
my age is 19
my age is 20

闄愬埗榪斿洖璁板綍鐨勫紑濮嬬偣skip()
浠庣3鏉¤褰曞紑濮嬶紝榪斿洖5鏉¤褰?limit 3, 5)
db.users.find().skip(3).limit(5);

鏌ヨ璁板綍鏉℃暟count()
db.users.find().count();
db.users.find({age:18}).count();
浠ヤ笅榪斿洖鐨勪笉鏄?錛岃屾槸user琛ㄤ腑鎵鏈夌殑璁板綍鏁伴噺
db.users.find().skip(10).limit(5).count();
濡傛灉瑕佽繑鍥為檺鍒朵箣鍚庣殑璁板綍鏁伴噺錛岃浣跨敤count(true)鎴栬卌ount(闈?)
db.users.find().skip(10).limit(5).count(true);

鍒嗙粍group()
鍋囪test琛ㄥ彧鏈変互涓嬩竴鏉℃暟鎹?br style="line-height: normal; " /> { domain: "www.mongodb.org"
, invoked_at: {d:"2009-11-03", t:"17:14:05"}
, response_time: 0.05
, http_action: "GET /display/DOCS/Aggregation"
}
浣跨敤group緇熻test琛?1鏈堜喚鐨勬暟鎹甤ount:count(*)銆乼otal_time:sum(response_time)銆?avg_time:total_time/count;
db.test.group(
   { cond: {"invoked_at.d": {$gt: "2009-11", $lt: "2009-12"}}
   , key: {http_action: true}
   , initial: {count: 0, total_time:0}
   , reduce: function(doc, out){ out.count++; out.total_time+=doc.response_time }
   , finalize: function(out){ out.avg_time = out.total_time / out.count }
   } );

[
  {
    "http_action" : "GET /display/DOCS/Aggregation",
    "count" : 1,
    "total_time" : 0.05,
    "avg_time" : 0.05
  }
]

鏉ヨ嚜: http://hi.baidu.com/asminfo/blog/item/20301e22dcfcce50ac34de7a.html



鐙肩埍涓婄嫺 2011-03-23 10:26 鍙戣〃璇勮
]]>
grails 鍗囩駭鍒?.3.6鐨勪貢鐮佽В鍐蟲柟娉?/title><link>http://www.tkk7.com/waterjava/archive/2011/03/23/346815.html</link><dc:creator>鐙肩埍涓婄嫺</dc:creator><author>鐙肩埍涓婄嫺</author><pubDate>Wed, 23 Mar 2011 02:25:00 GMT</pubDate><guid>http://www.tkk7.com/waterjava/archive/2011/03/23/346815.html</guid><wfw:comment>http://www.tkk7.com/waterjava/comments/346815.html</wfw:comment><comments>http://www.tkk7.com/waterjava/archive/2011/03/23/346815.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.tkk7.com/waterjava/comments/commentRss/346815.html</wfw:commentRss><trackback:ping>http://www.tkk7.com/waterjava/services/trackbacks/346815.html</trackback:ping><description><![CDATA[<table style="table-layout: fixed; width: 960px; font-family: Arial; font-size: 12px; line-height: 18px; "> <tbody> <tr> <td style="font-family: Arial; word-wrap: break-word; word-break: break-all; visibility: visible !important; zoom: 1 !important; filter: none; font-size: 12px; line-height: 18px; "> <div class="hjtsrbe" id="blog_text" class="cnt" style="font-family: Arial; word-wrap: break-word; word-break: normal; visibility: visible !important; zoom: 1 !important; filter: none; font-size: 14px; line-height: 20px; color: #333333; overflow-x: hidden; overflow-y: hidden; position: static; "> <p style="line-height: normal; ">鍘熷厛鐨刧rails鏄?.2.0錛屼粠榪欎釜鐗堟湰涔嬪悗錛屾垜璇曡繃1.2.1錛?.2.2錛?.3.0錛?.3.1錛屼絾閮藉洜涓虹▼搴忓湪榪愯鏃朵細鍙樻垚涔辯爜錛岃屼竴鐩翠嬌鐢ㄧ潃1.2.0銆?/p> <p style="line-height: normal; ">鎴戜滑鐨凾OMCAT浣跨敤鐨勬槸GBK緙栫爜錛孏RAILS鏂囨湰閮芥槸浣跨敤UTF-8緙栫爜錛屾墍浠ワ紝榪欐槸浜х敓涔辯爜鐨勬牴鏈師鍥犮?/p> <p style="line-height: normal; ">鏈榪戝張鏈塯rails1.3.6錛屾洿鏂板緱寰堝揩錛岀綉涓婃壘浜嗘壘錛屾湁瑙e喅鏂規(guī)浜嗐?a target="_blank" style="line-height: normal; ">http://www.groovyq.net/content/grails13%E5%8F%91%E5%B8%83</a></p> <p style="line-height: normal; ">鍦ㄦ湇鍔″櫒涓婁竴璇曪紝鏋滅劧鑳借銆傜幇璁板綍濡備笅錛?/p> <p style="line-height: normal; ">閲嶆柊璁懼畾System.out鐨勭紪鐮侊紝灝嗕笅闈㈣鍙ュ姞鍏ュ埌_GrailsInit.groovy涓紝鎴栬呭姞鍏ュ伐紼嬬殑BootStrap.groovy鐨刬nit孌靛嵆鍙?br style="line-height: normal; " /> System.out = new PrintStream(System.out, true,"GB2312");</p> <p style="line-height: normal; "> </p> <p style="line-height: normal; ">鎴戜嬌鐢ㄧ殑鏄浜岀鏂規(guī)硶錛屽湪BootStrap.groovy鐨刬nit孌典腑鍔犲叆浠ヤ笂璇彞銆?/p> <p style="line-height: normal; ">浠ュ墠錛屾湁浣嶉珮鎵嬩篃鎻愬埌榪囷紝浣嗕粬鐨勫師鏂囨槸錛?/p> <p style="line-height: normal; ">“濡傛灉鏄痯rintln鎵撳嵃涓枃涔辯爜鐨勮瘽錛岄偅涔堝氨鍦ㄥ垵濮嬪寲鏂囦歡涓鍔?br style="line-height: normal; " />  System.out = new  PrintStream(System.out, true, "GBK") <br style="line-height: normal; " /> 灝卞簲璇ヤ簡錛屼綘嫻嬭瘯涓涓嬪惂錛?”</p> <p style="line-height: normal; ">鎵浠ユ垜涓鐩翠互涓烘槸瑙e喅鎵撳嵃涔辯爜鐨勩?/p> <p style="line-height: normal; ">鍦ㄦ涓騫惰阿榪囥?/p> <p style="line-height: normal; "><br /> </p> <p style="line-height: normal; ">鏉ヨ嚜: <span style="line-height: 20px; "><a >http://hi.baidu.com/caihexi/blog/item/76d093a4cce0c6e59152ee15.html</a></span></p> </div> </td> </tr> </tbody> </table> <img src ="http://www.tkk7.com/waterjava/aggbug/346815.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.tkk7.com/waterjava/" target="_blank">鐙肩埍涓婄嫺</a> 2011-03-23 10:25 <a href="http://www.tkk7.com/waterjava/archive/2011/03/23/346815.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣〃璇勮</a></div>]]></description></item><item><title>MongoDB鐨勫熀鏈搷浣?/title><link>http://www.tkk7.com/waterjava/archive/2011/03/23/346814.html</link><dc:creator>鐙肩埍涓婄嫺</dc:creator><author>鐙肩埍涓婄嫺</author><pubDate>Wed, 23 Mar 2011 02:24:00 GMT</pubDate><guid>http://www.tkk7.com/waterjava/archive/2011/03/23/346814.html</guid><wfw:comment>http://www.tkk7.com/waterjava/comments/346814.html</wfw:comment><comments>http://www.tkk7.com/waterjava/archive/2011/03/23/346814.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.tkk7.com/waterjava/comments/commentRss/346814.html</wfw:commentRss><trackback:ping>http://www.tkk7.com/waterjava/services/trackbacks/346814.html</trackback:ping><description><![CDATA[璇︾粏璇烽槄:  <div><a >http://www.oschina.net/code/snippet_35115_2888</a></div> <img src ="http://www.tkk7.com/waterjava/aggbug/346814.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.tkk7.com/waterjava/" target="_blank">鐙肩埍涓婄嫺</a> 2011-03-23 10:24 <a href="http://www.tkk7.com/waterjava/archive/2011/03/23/346814.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣〃璇勮</a></div>]]></description></item><item><title>MongoDB鐨勮嚜澧為暱涓婚敭鐨勫疄鐜?/title><link>http://www.tkk7.com/waterjava/archive/2011/03/23/346813.html</link><dc:creator>鐙肩埍涓婄嫺</dc:creator><author>鐙肩埍涓婄嫺</author><pubDate>Wed, 23 Mar 2011 02:23:00 GMT</pubDate><guid>http://www.tkk7.com/waterjava/archive/2011/03/23/346813.html</guid><wfw:comment>http://www.tkk7.com/waterjava/comments/346813.html</wfw:comment><comments>http://www.tkk7.com/waterjava/archive/2011/03/23/346813.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.tkk7.com/waterjava/comments/commentRss/346813.html</wfw:commentRss><trackback:ping>http://www.tkk7.com/waterjava/services/trackbacks/346813.html</trackback:ping><description><![CDATA[璇︾粏璇烽槄:  <div><a >http://www.oschina.net/code/snippet_35115_2915</a></div> <img src ="http://www.tkk7.com/waterjava/aggbug/346813.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.tkk7.com/waterjava/" target="_blank">鐙肩埍涓婄嫺</a> 2011-03-23 10:23 <a href="http://www.tkk7.com/waterjava/archive/2011/03/23/346813.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣〃璇勮</a></div>]]></description></item><item><title>mongo鐨勫垵浣撻獙http://www.tkk7.com/waterjava/archive/2011/03/23/346812.html鐙肩埍涓婄嫺鐙肩埍涓婄嫺Wed, 23 Mar 2011 02:22:00 GMThttp://www.tkk7.com/waterjava/archive/2011/03/23/346812.htmlhttp://www.tkk7.com/waterjava/comments/346812.htmlhttp://www.tkk7.com/waterjava/archive/2011/03/23/346812.html#Feedback0http://www.tkk7.com/waterjava/comments/commentRss/346812.htmlhttp://www.tkk7.com/waterjava/services/trackbacks/346812.html棣栧厛鍦╩ongo瀹樼綉涓嬭澆Windows鐨勭増鏈?/span> 

鍚姩鏈嶅姟錛歮ongod.exe --port 12345 --dbpath=c:\mongodb\db 
鏄劇ず涓涓嬩俊鎭細 
Fri Dec 04 14:30:32 Mongo DB : starting : pid = 0 port = 12345 dbpath = c:\mongo 
db\db master = 0 slave = 0  32-bit 

** NOTE: when using MongoDB 32 bit, you are limited to about 2 gigabytes of data 

**       see http://blog.mongodb.org/post/137788967/32-bit-limitations for more 

Fri Dec 04 14:30:32 db version v1.1.4-, pdfile version 4.5 
Fri Dec 04 14:30:32 git version: c67c2f7dd681152f1784c8e1c2119b979e65881d 
Fri Dec 04 14:30:32 sys info: windows (5, 1, 2600, 2, 'Service Pack 3') BOOST_LI 
B_VERSION=1_35 
Fri Dec 04 14:30:32 waiting for connections on port 12345 


鍚姩瀹㈡埛绔細mongo.exe localhost:12345 

媯鏌ユ槸鍚︽甯?db.foo.save({a:1,b:9}) 
     db.foo.find({a:1}) 
鎺у埗鍙版樉紺猴細{ "_id" : ObjectId("4b18b5b56f40000000006cec"), "a" : 1, "b" : 9 } 


娣誨姞鏁版嵁錛歞b.foo.save({a:1,b:9}) 

鏌ヨ鏁版嵁錛歞b.foo.find({a:1})  //{a:1}鏄煡璇㈡潯浠訛紝褰撲負絀烘椂鏌ヨ鎵鏈?/span> 
  db.foo.findOne({a:1}) //鏄劇ず鍑轟竴鏉℃暟鎹?/span> 

鍒犻櫎鏁版嵁錛歞b.foo.remove({a:1}) //鍒犻櫎a=1鐨勬暟鎹?/span> 

琛ㄧ殑鏁版嵁閲?db.foo.find().count() 

鏄劇ず鏁版嵁鎸囧畾鐨勬潯鏁?db.foo.find().limit(n) 

鏄劇ず搴撳悕:db.foo.getDB() 

鑾峰彇绱㈠紩鍊鹼細db.foo.getIndexes() 

琛ㄧ殑緇熻:db.foo.stats() 

鍒犻櫎琛?db.foo.drop() 

鑾峰彇涓嶉噸澶嶇殑鍒楋細db.foo.distinct( key ) - eg. db.foo.distinct( 'x' ) 

蹇界暐鍓嶉潰鐨勫嚑琛岋細db.other.find({a:2}).skip(2)//蹇界暐a=2涓殑鍓嶉潰2琛?/span> 

鏂規(guī)硶甯姪:db.foo.help() 


HELP 
        show dbs                     show database names 
        show collections             show collections in current database 
        show users                   show users in current database 
        show profile                 show most recent system.profile entries with time >= 1ms 
        use <db name>                set curent database to <db name> 
        db.help()                    help on DB methods 
        db.foo.help()                help on collection methods 
        db.foo.find()                list objects in collection foo 
        db.foo.find( { a : 1 } )     list objects in foo where a == 1 
        it                           result of the last line evaluated; use to further iterate 


DB methods: 
        db.addUser(username, password) 
        db.auth(username, password) 
        db.cloneDatabase(fromhost) 
        db.commandHelp(name) returns the help for the command 
        db.copyDatabase(fromdb, todb, fromhost) 
        db.createCollection(name, { size : ..., capped : ..., max : ... } ) 
        db.currentOp() displays the current operation in the db 
        db.dropDatabase() 
        db.eval(func, args) run code server-side 
        db.getCollection(cname) same as db['cname'] or db.cname 
        db.getCollectionNames() 
        db.getLastError() - just returns the err msg string 
        db.getLastErrorObj() - return full status object 
        db.getMongo() get the server connection object 
        db.getMongo().setSlaveOk() allow this connection to read from the nonmaster member of a replica pair 
        db.getName() 
        db.getPrevError() 
        db.getProfilingLevel() 
        db.getReplicationInfo() 
        db.getSisterDB(name) get the db at the same server as this onew 
        db.killOp() kills the current operation in the db 
        db.printCollectionStats() 
        db.printReplicationInfo() 
        db.printSlaveReplicationInfo() 
        db.printShardingStatus() 
        db.removeUser(username) 
        db.repairDatabase() 
        db.resetError() 
        db.runCommand(cmdObj) run a database command.  if cmdObj is a string, turns it into { cmdObj : 1 } 
        db.setProfilingLevel(level) 0=off 1=slow 2=all 
        db.shutdownServer() 
        db.version() current version of the server 

DBCollection help 
        db.foo.count() 
        db.foo.dataSize() 
        db.foo.distinct( key ) - eg. db.foo.distinct( 'x' ) 
        db.foo.drop() drop the collection 
        db.foo.dropIndex(name) 
        db.foo.dropIndexes() 
        db.foo.ensureIndex(keypattern,options) - options should be an object with these possible fields: name, unique, dropDups 
        db.foo.find( [query] , [fields]) - first parameter is an optional queryfilter. second parameter is optional set of fields to return.  e.g. db.foo.find( { x : 77 } , { name : 1 , x : 1 } ) 
        db.foo.find(...).count() 
        db.foo.find(...).limit(n) 
        db.foo.find(...).skip(n) 
        db.foo.find(...).sort(...) 
        db.foo.findOne([query]) 
        db.foo.getDB() get DB object associated with collection 
        db.foo.getIndexes() 
        db.foo.group( { key : ..., initial: ..., reduce : ...[, cond: ...] } ) 
        db.foo.mapReduce( mapFunction , reduceFunction , <optional params> ) 
        db.foo.remove(query) 
        db.foo.renameCollection( newName ) renames the collection 
        db.foo.save(obj) 
        db.foo.stats() 
        db.foo.storageSize() - includes free space allocated to this collection 
        db.foo.totalIndexSize() - size in bytes of all the indexes 
        db.foo.totalSize() - storage allocated for all data and indexes 
        db.foo.update(query, object[, upsert_bool]) 
        db.foo.validate() - SLOW 
        db.foo.getShardVersion() - only for use with shardin

]]>
主站蜘蛛池模板: 免费一级毛片在播放视频| 最新亚洲人成网站在线观看| 亚洲性日韩精品一区二区三区| a毛片免费观看完整| 亚洲第一成年网站视频| 亚洲精品国产专区91在线| 亚洲午夜久久久久久久久久| 国产精品国产午夜免费福利看 | 国产精品美女久久久免费 | 亚洲av成人一区二区三区观看在线 | 亚洲一区在线免费观看| 久久精品夜色国产亚洲av| 综合亚洲伊人午夜网 | 亚洲AV无码欧洲AV无码网站| 亚洲国产精品13p| 国产一级大片免费看| 免费毛片网站在线观看| 久久久久久久久免费看无码| 最近高清中文字幕无吗免费看| 久久青草国产免费观看| 暖暖免费日本在线中文| 在线观看免费无码专区| 国产无遮挡无码视频免费软件| 国产精品偷伦视频观看免费| 国产午夜无码片免费| 国产午夜无码精品免费看| 国产在线国偷精品免费看| 2022国内精品免费福利视频| 成在人线av无码免费高潮水| 免费看少妇高潮成人片| 少妇人妻偷人精品免费视频| 巨波霸乳在线永久免费视频 | 成人免费看吃奶视频网站| 精品久久洲久久久久护士免费| 国产午夜无码视频免费网站| 亚洲成av人在片观看| 亚洲av最新在线网址| 亚洲一区二区三区亚瑟| 免费国产a理论片| 免费人成网站在线观看不卡 | 亚洲国产精品成人AV在线|