MongoDB and Its C # driver

Source: Internet
Author: User

1: Brief Introduction

MongoDB is a distributed document database that supports a master-slave structure similar to a relational database. It stores documents in binary Json format, without locks, transactions, and indexes.

2: Installation Steps

Step 1: Download the Assembly http://www.mongodb.org/downloads

Part 2: extract and extract the relevant bin directory to C: \ Mongo (this option is optional), and create a db folder under this directory.

Part 3: Open the CMD window, go to the C: \ Mongo \ bindirectory, and run mongod.exe -- dbpath = "c: \ Mongo \ db"

Step 4: open another window (keep the previous window closed) to run cmd.exe. In this window, you can execute simple commands, which are listed below

> J = {name: "mongo "};
{"Name": "mongo "}
> T = {x: 3 };
{"X": 3}
> Db. things. save (j );
> Db. things. save (t );
> Db. things. find ();
{"_ Id": ObjectId ("4c2209f9f3924d31102bd84a"), "name": "mongo "}
{"_ Id": ObjectId ("4c2209fef3924d31102bd84b"), "x": 3}
>

> For (var I = 1; I <= 20; I ++) db. things. save ({x: 4, j: I });
> Db. things. find ();

> Var cursor = db. things. find ();
> While (cursor. hasNext () printjson (cursor. next ());

> Db. things. find (). forEach (printjson );

> Var cursor = db. things. find ();
> Printjson (cursor [4]);

> Var arr = db. things. find (). toArray ();
> Arr [5];

 

> Db. things. find ({name: "mongo"}). forEach (printjson );

 

> Db. things. find ({x: 4}, {j: true}). forEach (printjson );

 

> Printjson (db. things. findOne ({name: "mongo "}));

 

> Db. things. find (). limit (3 );

3: c # driver

The following describes several C # drivers.

Article 1: mongodb-csharp Project address: http://github.com/samus/mongodb-csharp

Brief Introduction: the driver is a full-featured driver with fast update. It has been applied to the project and performs very well. At present, their team is working on expansion of connection management functions, such as automatic reconnection and connection pool.

 

Article 2: mongodb-net project address: http://code.google.com/p/mongodb-net/

Brief Introduction: The development is still in progress, and some features are not yet implemented.

 

Article 3 MongoDB. Emitter Project address: http://bitbucket.org/gwbasic/mongodb.emitter/

Brief Introduction: supports strong types

 

Section 4: CSMongo Project address: http://somewebguy.wordpress.com/2010/02/21/building-a-mongo-driver-part-1/

Brief Introduction: some functions are implemented and there is no downloadable code. But you can read his blog to understand this idea.

 

Article 5: simple-mongodb Project address: http://code.google.com/p/simple-mongodb/

Brief Introduction: source code is not provided, with JSon as the core.

 

The last one is the enhancement to the first one in some places, address http://deserialized.com/convert-csharp-classes-to-and-from-mongodb-documents-automatically-using-net-reflection

 

Article 6 NoRM project address: http://github.com/atheken/NoRM

Description: The first type is enhanced. Strong types are supported.

 

The ranking is in sequence. Now I want to see NoRM and mongodb-csharp again.

 

Note:

Although these materials come from the Internet, they are used for your convenience. I still put my face on the homepage. Sorry.

 

 

 

 

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.