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. C#-WebService基础02

    WebService WSDL是web service的交换格式 跨平台数据交互 什么是web服务 SOA 面向服务的体系结构  service-Oriented Architecture Servi ...

  2. 各种List、Map、Set的比較

    前言:Java中用不同的数据结构(哈希表/动态数组/平衡树/链表)实现了不同的集合接口(List/Map/Set).大多数情况下,集合类被用于不须要线程安全地环境,所以后来的集合实现都没有再採用同步以 ...

  3. 走进windows编程的世界-----入门篇

    1   Windows编程基础 1.1Win32应用程序基本类型 1)  控制台程序 不须要完好的windows窗体,能够使用DOS窗体方式显示 2)  Win32窗体程序 包括窗体的程序,能够通过窗 ...

  4. 在Redhat Linux中执行非Redhat的Openstack, Redhat将对其Linux不提供支持

    一声叹息. IBM.HP.Dell, Mirantis, Piston等.请问.你们还把你们的Openstack部署在Redhat中吗? http://blogs.wsj.com/digits/201 ...

  5. 个人andriod实习小作品,个人联网笔记本

    个人联网笔记本 个人信息:就读于燕大本科软件project专业 眼下大四; 本人博客:google搜索"cqs_2012"就可以; 个人爱好:酷爱数据结构和算法,希望将来从事算法工 ...

  6. [HEOI2016/TJOI2016] 排序 解题报告(二分答案/线段树分裂合并+set)

    题目链接: https://www.luogu.org/problemnew/show/P2824 题目描述: 在2016年,佳媛姐姐喜欢上了数字序列.因而他经常研究关于序列的一些奇奇怪怪的问题,现在 ...

  7. springboot shiro 多realm配置认证、授权

    shiro进行登录认证和权限管理的实现.其中需求涉及使用两个角色分别是:门店,公司.现在要两者实现分开登录.即需要两个Realm——MyShiroRealmSHOP和MyShiroRealmCOMPA ...

  8. ios各个屏幕

    func currentDeviceScreenMeasurement() -> CGFloat { var deviceScree: CGFloat = 3.5 if ((568 == SCR ...

  9. C#线程调用带参数的方法,给控件赋值

    System.Threading.Thread thread = new System.Threading.Thread(() => { //各种业务 //定义一个委托 public deleg ...

  10. MyBatis数据持久化(五)数据源配置优化

    在前面的教程中,我们把数据库的驱动.用户名.密码等配置项全部写在 SqlMapConfig.xml中: <dataSource type="POOLED"> <p ...