https://docs.mongodb.com/getting-started/csharp/introduction/

MongoDB is an open-source document database that provides high performance, high availability, and automatic scaling.

MongoDB obviates the need for an Object Relational Mapping (ORM) to facilitate development.

Documents

A record in MongoDB is a document, which is a data structure composed of field and value pairs.

MongoDB documents are similar to JSON objects.

The values of fields may include other documents, arrays, and arrays of documents.

{
"_id" : ObjectId("54c955492b7c8eb21818bd09"),
"address" : {
"street" : "2 Avenue",
"zipcode" : "10075",
"building" : "1480",
"coord" : [ -73.9557413, 40.7720266 ]
},
"borough" : "Manhattan",
"cuisine" : "Italian",
"grades" : [
{
"date" : ISODate("2014-10-01T00:00:00Z"),
"grade" : "A",
"score" : 11
},
{
"date" : ISODate("2014-01-16T00:00:00Z"),
"grade" : "B",
"score" : 17
}
],
"name" : "Vella",
"restaurant_id" : "41704620"
}

Collections

MongoDB stores documents in collections.

Collections are analogous to tables in relational databases.

Unlike a table, however, a collection does not require its documents to have the same schema.

In MongoDB, documents stored in a collection must have a unique _id field that acts as a primary key

primary key

A record’s unique immutable identifier.

In an RDBMS, the primary key is typically an integer stored in each row’s id field.

In MongoDB, the _id field holds a document’s primary key which is usually a BSON ObjectId.

RDBMS

Relational Database Management System.

A database management system based on the relational model, typically using SQL as the query language.

SQL

Structured Query Language (SQL) is a common special-purpose programming language used for interaction with a relational database, including access control, insertions, updates, queries, and deletions.

There are some similar elements in the basic SQL syntax supported by different database vendors, but most implementations have their own dialects方言, data types, and interpretations解释 of proposed SQL standards.

Complex SQL is generally not directly portable手提的,便携式的,轻便的 between major RDBMS products. SQL is often used as metonym换喻中所使用的词或短语 for relational databases.

_id

A field required in every MongoDB document.

The _id field must have a unique value.

You can think of the_id field as the document’s primary key.

If you create a new document without an _id field, MongoDB automatically creates the field and assigns a unique BSON ObjectId.

document

A record in a MongoDB collection and the basic unit of data in MongoDB.

Documents are analogous类似 toJSON objects but exist in the database in a more type-rich format known as BSON. See Documents.

collection

A grouping of MongoDB documents.

A collection is the equivalent of an RDBMS table.

A collection exists within a single database.

Collections do not enforce a schema.

Documents within a collection can have different fields.

Typically, all documents in a collection have a similar or related purpose. See Namespaces.

ObjectId

A special 12-byte BSON type that guarantees uniqueness within the collection.

The ObjectId is generated based on timestamp, machine ID, process ID, and a process-local incremental counter.

MongoDB uses ObjectId values as the default values for _id fields.

总结

在MongoDB中,一条记录,就是一个Document,Document是由很多"字段-值"的构成的。【对应关系型数据库中表的一行】

字段的值可以是其他的Document,数组,或者由Document组成的数组。

每一个Document都有一个_id字段,如果你不赋值,MongoDB会自动生成一个值

MongoDB把Document存储在Collection中,Collection等同于关系型数据库中的Table。

Collection不要求Document保持相同的格式,但是一般来讲,一个Collection中的Document会保持相同的格式。

Introduction to MongoDB的更多相关文章

  1. MongoDB - Introduction to MongoDB, MongoDB Extended JSON

    JSON can only represent a subset of the types supported by BSON. To preserve type information, Mongo ...

  2. MongoDB - Introduction to MongoDB

    MongoDB is an open-source document database that provides high performance, high availability, and a ...

  3. MongoDB - Introduction to MongoDB, Capped Collections

    Overview Capped collections are fixed-size collections that support high-throughput operations that ...

  4. MongoDB - Introduction to MongoDB, Documents

    MongoDB stores data records as BSON documents. BSON is a binary representation of JSON documents, th ...

  5. MongoDB - Introduction to MongoDB, BSON Types

    BSON is a binary serialization format used to store documents and make remote procedure calls in Mon ...

  6. MongoDB - Introduction to MongoDB, Databases and Collections

    MongoDB stores BSON documents, i.e. data records, in collections; the collections in databases. Data ...

  7. Table of Contents - MongoDB

    Getting Started Installation Installing MongoDB on Windows Installing MongoDB on Linux Introduction ...

  8. MongoDB学习day04--NodeJs操作数据库增删改查

    一.在Nodejs中使用Mongodb Nodejs需要引入的包 npm install mongodb --save -dev 或者使用镜像 cnpm install mongodb --save ...

  9. Getting Started with MongoDB (MongoDB Shell Edition)

    https://docs.mongodb.com/getting-started/shell/ Overview Welcome to the Getting Started with MongoDB ...

随机推荐

  1. 2015 Multi-University Training Contest 8 hdu 5389 Zero Escape

    Zero Escape Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 131072/131072 K (Java/Others)Tot ...

  2. mysql 全表扫描、全索引扫描、索引覆盖(覆盖索引)

    full index scan:全索引扫描,查询时,遍历索引树来获取数据行.如果数据不是密集的会产生随机IO 在执行计划中是Type列,index full table scan:通过读物理表获取数据 ...

  3. IntelliJ IDEA中JAVA连接MYSQL

    1.下载mysql包 2.项目中引入mysql包 3.连接数据库,查询结果 看jdbc数据库连接类 package Facade; import java.sql.*; /** * Created b ...

  4. Another app is currently holding the yum lock; waiting for it to exit…

    yum被锁定无法使用,错误信息截图如下:解决方法:rm -rf /var/run/yum.pid 来强行解除锁定,然后你的yum就可以运行了

  5. 132.try throw catch介绍

    #include <iostream> using namespace std; //try尝试执行,抛出throw,throw之后语句不再执行 //catch处理throw的异常 voi ...

  6. iOS开发-Tools-CocoaPods

    CocoaPods是什么? 当你开发iOS应用时,会经常使用到很多第三方开源类库,比如JSONKit,AFNetWorking等等.可能某个类库又用到其他类库,所以要使用它,必须得另外下载其他类库,而 ...

  7. C# 位域[flags]

    .NET中的枚举我们一般有两种用法,一是表示唯一的元素序列,例如一周里的各天:还有就是用来表示多种复合的状态.这个时候一般需要为枚举加上[Flags]特性标记为位域,例如: [Flags]   enu ...

  8. Quartz介绍和使用

    Quartz介绍和使用 什么是Quartz,干什么的? Quartz框架是一个全功能.开源的任务调度服务,可以集成几乎任何的java应用程序—从小的单片机系统到大型的电子商务系统.Quartz可以执行 ...

  9. Servlet学习(三)——实例:用户登录并记录登陆次数

    1.前提:在Mysql数据库下建立数据库web13,在web13下创建一张表user,插入几条数据如下: 2.创建HTML文件,命名为login,作为登录界面(以post方式提交) <!DOCT ...

  10. Dapper基础知识四之 利用Dapper获取不同类型的主键值

    在下刚毕业工作,之前实习有用到Dapper?这几天新项目想用上Dapper,在下比较菜鸟,这块只是个人对Dapper的一种总结. 一下是Dapper源码几种主键,当主键不包含"ID" ...