MIS2000 Lab. -- ASP.NET学习&分享 / ASP.NET案例精编(清华大学出版社)
您好,我来自台湾。很高兴与各位分享一些成果。希望对您有帮助。出版书籍是「ASP.NET案例精编 / 清华大学出版社」。

ASP.NET WebForm & MongoDB

 

最近在朋友介绍下,也跟着看AngularJS
买了一本三合一的书,Node.JS+MongoDB+AngularJS
http://www.pearsoned.co.uk/bookshop/detail.asp?item=100000000577793

当然,我看简体中文版的 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称为 Document)

 

====== 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/getting_started/quick_tour/


    趋势科技导入MongoDB 追踪管理全球10万个行动装置
    http://www.ithome.com.tw/tech/87418

 

另一个有趣的问题:

    在 Windows 上使用 Node.js 连接到 SQL Database
    https://azure.microsoft.com/zh-tw/documentation/articles/sql-database-develop-nodejs-simple-windows
/

    Introducing the Microsoft Driver for Node.JS for SQL Server
    http://blogs.msdn.com/b/sqlphp/archive/2012/06/08/introducing-the-microsoft-driver-for-node-js-for-sql-server.aspx

    Youtube影片 -- How to connect to Microsoft SQL Server database using NodeJs
    https://www.youtube.com/watch?v=MLcXfRH1YzE
 

 

posted on 2015-12-22 17:02  MIS2000 Lab.  阅读(408)  评论(0编辑  收藏  举报


ASP.NET案例精编——适用于VS 2005/2008(配光盘)
 

当当网购买 http://product.dangdang.com/product.aspx?product_id=20583373&ref=search-1-pub