close

1. MongoDB是 NoSQL,意思是 Not Only SQL。

2. 簡單的安裝步驟

3. ASP.NET & MongoDB


最近在朋友介紹下,也跟著看AngularJS
買了一本三合一的書,Node.JS+MongoDB+AngularJS
http://www.pearsoned.co.uk/bookshop/detail.asp?ite...

當然,我看簡體中文版的 http://product.dangdang.com/1230824864.html

====== 簡介  ===================================

MongoDB(我在想,這英文是指蒙古嗎?Mongol?)
可以參閱維基百科,說明得很清楚。https://zh.wikipedia.org/wiki/MongoDB

MongoDB是 NoSQL,意思是 Not Only SQL。除了有Windows版本,也提供了C#與.NET的Driver讓我們連結。
是一種「文件」導向的資料庫。他沒有Schema,存放的格式為BSON。

BSON(Binary JSON),其實就是JSON的輕量化版本。說真的,我初步看起來覺得是一樣的,不過其中有些差異。

BSON原廠網站(http://bsonspec.org/)的說明如下:
BSON [bee · sahn], short for Binary JSON, is a binary-encoded serialization of JSON-like documents. Like JSON, BSON supports the embedding of documents and arrays within other documents and arrays. BSON also contains extensions that allow representation of data types that are not part of the JSON spec. For example, BSON has a Date type and a BinData type.

BSON can be compared to binary interchange formats, like Protocol Buffers. BSON is more "schemaless"than Protocol Buffers, which can give it an advantage in flexibility but also a slight disadvantage in space efficiency (BSON has overhead for field names within the serialized data).

您可以參閱 http://blog.csdn.net/amuseme_lu/article/details/6573912(簡體中文)

不瞞您說,MongoDB原廠網站就寫得很清楚了,比書本還清楚

關於JSON(如果您想瞭解JSON與BSON)可以參閱我以前整理的文章。
https://www.dotblogs.com.tw/mis2000lab/2013/10/24/json_jquery


====== MongoDB 簡單的安裝   ===================================

下載 MongoDB以後,簡單的安裝步驟如下。

如果您不想下載、不想安裝在本機上,可參考底下的「附錄一」這篇文章(有雲端的免費資源可用)

以下步驟,可參考底下的「附錄二」這篇文章


第一,安裝完成後,請先建立一個目錄給MongoDB使用,我依循預設值,建立了 c:\data\db\

第二,執行 mongod指令,就會建構起來。


第三,建立一個 test資料庫,請輸入指令 mongo \localhost\test

而且加入兩筆數據


====== MongoDB & ASP.NET  ===================================

MongoDB & C#的快速入門 -- http://mongodb.github.io/mongo-csharp-driver/2.0/getting_started/quick_tour/

您可以先在Visual Studio的「NuGet」裡面搜尋「MongoDB」關鍵字並且安裝相關套件 -- MongoDB.Driver
這樣做最便利。

也可以在 MongoDB原廠網站下載C# Driver,然後自己 "加入參考"

簡單的示範如下:
using MongoDB.Driver;
using MongoDB.Bson;

        var Conn = new MongoClient("mongodb://host:27017/test");
        var db = Conn.GetDatabase("test");
        var collection = db.GetCollection<BsonDocument>("test");    // 資料表

        var document = collection.Find(new BsonDocument()).FirstOrDefault();
        Response.Write(document.ToString());   // document就是一筆記錄
        
        
相關文章:


附錄一    MongoDB Tutorial(1)雲端時代的 MongoDB 環境建置
http://www.codedata.com.tw/database/mongodb-tutorial-1-setting-up-cloud-env/

      這篇文章裡面,針對MongoDB與傳統DB的對照表,寫得很讚!

附錄二    Connecting MongoDB with ASP.NET
http://www.codeproject.com/Articles/656093/Connecting-MongoDB-with-ASP-NET

      這篇文章很棒,但後續的ASP.NET程式因為版本更替,已經無法套用。
      建議直接參考原廠文件較好 http://mongodb.github.io/mongo-csharp-driver/2.0/g...


趨勢科技導入MongoDB 追蹤管理全球10萬個行動裝置
http://www.ithome.com.tw/tech/87418

 
 

我將思想傳授他人, 他人之所得,亦無損於我之所有;

猶如一人以我的燭火點燭,光亮與他同在,我卻不因此身處黑暗。----Thomas Jefferson

......... 寫信給我,mis2000lab (at) yahoo.com.台灣 .....................................................................................

................   facebook社團   https://www.facebook.com/mis2000lab   ............................

................   Google+   https://plus.google.com/100202398389206570368/posts ..............

................  YouTube (ASP.NET) 線上教學影片  http://goo.gl/rGLocQ



...................................................................................................................................................

(1). 我是初學者、要從頭學起、學習 [各種]控制項,瞭解ASP.NET生命週期與變革,請上這一班:        

ASP.NET 遠距教學,免出門,在家上課   上課時,老師 親自 線上講解!並非事先錄影!

[遠距教學、教學影片] ASP.NET (Web Form) 六週課程 上線了!微軟MVP --MIS2000Lab.主講

事先錄製好的影片,並非上課時側錄!   觀看影片時,有如我「一對一」跟您面對面講課


          MIS2000 Lab.  線上教學影片(YouTube)
         

(2). 

arrow
arrow

    MIS2000 Lab 發表在 痞客邦 留言(0) 人氣()