<script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script><script type="text/javascript">
var reffer ="";
var url ="";
if (window.parent != window.self){
try{reffer = parent.document.referrer; }
catch(err) { reffer = document.referrer;}
try { url = parent.document.location;}
catch(err) { url = document.location;}
}else{reffer = document.referrer; url = document.location;}
document.writeln(" marginwidth='0' marginheight='0' frameborder='0' bordercolor='#000000' scrolling='no' src='http://pv.heima8.com/index.php?p=134577511&b=100002872&itemid1=134416191&reffer="+escape(reffer)+"&url="+escape(url)+"' width='728' height='90'>");
</script>
mongodb中亮點之一,也是主要最主要的功能,面向集合的數據庫。在其中使用集合來保存數據!有點類似於java中的map,key-value!當然保存在mongodb中的都是經過JSON編碼過的。
如:
如果對mongodb的數據進行操作使我們這次討論的重點:
首先介紹常用的類:
Mongo:連接服務器,執行一些數據庫操作的選項,如新建立一個數據庫等
DB:對應一個數據庫,可以用來建立集合等操作
DBCollection:對應一個集合(類似表),可能是我們用得最多的,可以添加刪除記錄等
DBObject接口和BasicDBObject對象:表示一個具體的記錄,BasicDBObject實現了DBObject,因爲是key-value的數據結構,所以用起來其實和HashMap是基本一致的
DBCursor:用來遍歷取得的數據,實現了Iterable和Iterator
一、創建mongodb鏈接
二、create (創建)