Brief analysis of MongoDB and its C # drive operation steps

Source: Internet
Author: User
Keywords Nbsp; http suitable for

1: Brief Introduction

MongoDB is a distributed document database, supporting the master-slave structure of similar closed database, documents are stored in binary http://www.aliyun.com/zixun/aggregation/16702.html ">json form, no locks, no transaction , indexed.

2: Installation Steps

The first step: Download the Assembly http://www.mongodb.org/downloads

Part II: Extract and extract the relevant bin directory under C:\Mongo (this arbitrary selection), and in this directory to build the DB folder.

Part III: Open the CMD window, into the C:\Mongo\bin directory, run Mongod.exe--dbpath= "C:\Mongo\db"

Fourth step: Again open the cmd window (keep the previous window does not close) run Mongo.exe. In this window you can perform simple commands, following a simple list of several

> 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]); &nBsp;> 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# version of the driver

The following is a brief introduction to the drivers for the C # version.

First paragraph: Mongodb-csharp Project address: Http://github.com/samus/mongodb-csharp

Brief introduction: This drive is a relatively full drive, the update is very fast, someone has been applied to the project, and performance is very good. Currently their team is working on the extension of the connection management feature such as automatic reconnection, connection pooling, and so on.

Second paragraph: mongodb-net Project address: http://code.google.com/p/mongodb-net/

Brief introduction: This development is still in progress, some features have not yet realized

Section III: Mongodb.emitter Project address: http://bitbucket.org/gwbasic/mongodb.emitter/

Brief introduction: Strong type support provided

Fourth paragraph: Csmongo Project address: http://somewebguy.wordpress.com/2010/02/21/building-a-mongo-driver-part-1/

Simple introduction: Some of the features are implemented, and there is no downloadable code. But you can look at his blog to understand this driving idea.

Fifth paragraph: Simple-mongodb Project address: http://code.google.com/p/simple-mongodb/

Brief introduction: No source code, with JSON as the core.

The last one is the enhancements to the first section, address Http://deserialized.com/convert-csharp-classes-to-and-from-mongodb-documents-automatically-using-net-reflection

Sixth paragraph: NoRM Project address: Http://github.com/atheken/NoRM

Introduction: Enhanced the first, strong type support.

Extended Reading

MongoDB Logo

MONGO is a high-performance, open source, modeless document database that can be used to replace traditional relational databases or key/value storage in many scenarios. MONGO uses C + + development to provide the following features:

Collection-oriented storage: data that is appropriate for storing objects and JSON forms.

Dynamic query: MONGO supports rich query expressions. Query directives use JSON-form tags to easily query objects and arrays embedded in the document.

Full index support: Includes document inline objects and arrays. The MONGO query optimizer analyzes query expressions and generates an efficient query plan.

Query monitoring: MONGO contains a monitoring tool for analyzing the performance of database operations.

Replication and automatic failover: The MONGO database supports data replication between servers, supporting master-from-mode and server replication. The primary goal of replication is to provide redundancy and automatic failover.

Efficient traditional storage: supports binary data and large objects such as photos or pictures.

Automatic fragmentation to support cloud-level scalability (in the early alpha phase): Automatic fragmentation supports a level of database clustering that can dynamically add additional machines.

The main goal of MongoDB is to set up a bridge between key/value storage (high performance and high scalability) and traditional RDBMS systems (rich functionality), combining the advantages of both. According to the official website description, MONGO is suitable for the following scenarios:

Site data: MONGO is ideal for real-time inserts, updates, and queries, as well as the replication and high scalability required for real-time data storage on the Web site.

Caching: Because of its high performance, MONGO is also suitable as a caching layer for the information infrastructure. After the system restarts, the persistent cache layer built by MONGO can avoid overloading the underlying data source.

Large size, low value data: It may be expensive to store some data using a traditional relational database, before which programmers often choose traditional files for storage.

Highly scalable scenario: MONGO is ideal for databases composed of dozens of or hundreds of servers. The MONGO roadmap already contains built-in support for the MapReduce engine.

Storage for objects and JSON data: MONGO's Bson data format is ideal for storing and querying in a documented format.

Naturally, the use of MongoDB can also have some limitations, such as it does not fit:

Highly transactional system: such as a bank or accounting system. Traditional relational databases are now more suitable for applications that require a large number of atomic complex transactions.

Traditional business intelligence applications: The BI database for a particular problem is a highly optimized query. For such applications, the Data warehouse may be a more appropriate choice.

Problems requiring SQL

MongoDB supports operating systems such as OS X, Linux, and Windows and provides drivers for Python,php,ruby,java and C + + languages, as well as drivers for Erlang and. NET platforms in the community.

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.