码迷,mamicode.com
首页 > 数据库 > 详细

Mango DB

时间:2017-07-10 20:07:52      阅读:673      评论:0      收藏:0      [点我收藏+]

标签:field   serial   ide   eating   too   control   pac   ups   scale   

mango db/no sql

benefits

1. no requirement for script for creating tables. column and constraints

2. good for rich model expeciaaly aggregate root to manage its subentities.e.g. the order total amount can be coded by the aggregaye object rather than the mvc controller.

3 GridFs to support query

4 easy to scale out

5 flexible schema

 

driver for .net

choose mangodbforcsharp nuget

mangoclient and mangoserver are 2 types that inter play with each other.

 

create collection in server object can create mango db with this simple method.

 

create db instance - download db from website, create folder Db, run the mangod command

 

add mango driver to mvc project

 

bson is the document model /representation for json. it provides better machanism for client to traverse document while json along cannot achieve. c# poco  can be serialize into bson document, it is the same with json but only bson document can be  query

 

robomongo is a great visual tool to manage mangi db.

 

modification can be Replace or Update. Replace is an upsert api .

 

concurrency need to be cosidered. version check is one of the approach , adds that in the condition of the update to avoid dirty write.

 

Delete

 

Query

Find mango db support query (eq, ne, gte keyworks)objects which help to return cursor, poco, casted objects. and work well with linQ.

 

mangocursor - return a cursor that takez class name and return for client.

LinQ  - apply the AsQueryable() method to the document collection object and return a ienumerable and then perdorm linq query.

 

Sort

Aggregate method on bsoncollection object Again use the filter object array (new beason document and nested bson)  to perform the group, subtract and sort. define fields for the output json.

 

pagination

 

Performance

index is offered in mango!!

use match file to reduce impact docs

limit return fields

 

GridFs is technique that mango db stoing binary files.

Mango DB

标签:field   serial   ide   eating   too   control   pac   ups   scale   

原文地址:http://www.cnblogs.com/Mattcoder/p/7147339.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!