Introduction to MongoDB
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的更多相关文章
- MongoDB - Introduction to MongoDB, MongoDB Extended JSON
JSON can only represent a subset of the types supported by BSON. To preserve type information, Mongo ...
- MongoDB - Introduction to MongoDB
MongoDB is an open-source document database that provides high performance, high availability, and a ...
- MongoDB - Introduction to MongoDB, Capped Collections
Overview Capped collections are fixed-size collections that support high-throughput operations that ...
- MongoDB - Introduction to MongoDB, Documents
MongoDB stores data records as BSON documents. BSON is a binary representation of JSON documents, th ...
- MongoDB - Introduction to MongoDB, BSON Types
BSON is a binary serialization format used to store documents and make remote procedure calls in Mon ...
- MongoDB - Introduction to MongoDB, Databases and Collections
MongoDB stores BSON documents, i.e. data records, in collections; the collections in databases. Data ...
- Table of Contents - MongoDB
Getting Started Installation Installing MongoDB on Windows Installing MongoDB on Linux Introduction ...
- MongoDB学习day04--NodeJs操作数据库增删改查
一.在Nodejs中使用Mongodb Nodejs需要引入的包 npm install mongodb --save -dev 或者使用镜像 cnpm install mongodb --save ...
- Getting Started with MongoDB (MongoDB Shell Edition)
https://docs.mongodb.com/getting-started/shell/ Overview Welcome to the Getting Started with MongoDB ...
随机推荐
- 五大最佳开源java性能监控工具
如果你正在寻找性能监控工具,不妨看看以下推荐的这五款开源工具,这些工具目前已经可以替代付费工具了,你可以看看是否是你的最佳选择.本文推荐的五款开源工具目前是开源社区中最受欢迎的. 1. Stagemo ...
- Tomcat远程代码执行漏洞(CVE-2017-12615)修复
一.漏洞介绍 2017年9月19日,Apache Tomcat官方确认并修复了两个高危漏洞,其中就有Tomcat远程代码执行漏洞,当存在漏洞的Tomcat运行在Windwos主机上,且启用了HTTP ...
- iOS UI16_数据持久化
// // Student.h // UI16_数据持久化 // // Created by dllo on 15/8/19. // Copyright (c) 2015年 zhozhicheng. ...
- libLAS1.8.0 编译和配置(VS2013+Win7 64)(一)
libLAS 是一个用来读写三维激光雷达数据(LiDAR) 的 C++ 库.在学习.科研和研发中都会广泛运用.怎样编译和配置自己所须要版本号的libLAS库确是一件麻烦耗时的事情. 笔者在Win7 6 ...
- poj_1952最大下降子序列,统计个数
其实不算难的一道题,但憋了我好久,嗯,很爽. #include<iostream> #include<cstdio> #include<string.h> #inc ...
- 15.boost最小生成树 prim_minimum_spanning_tree
#include <iostream> #include <boost/config.hpp> //图(矩阵实现) #include <boost/graph/adjac ...
- ios各个屏幕
func currentDeviceScreenMeasurement() -> CGFloat { var deviceScree: CGFloat = 3.5 if ((568 == SCR ...
- java中三个类别加载器的关系以及各自加载的类的范围
Java在需要使用类别的时候,才会将类别加载,Java的类别载入是由类别载入器(Class loader)来达到的,预设上,在程序启动之后,主要会有三个类别加载器:Bootstrap Loader.E ...
- Ubantu 14.04下安装高版本cmake
Ubantu14.04 下自带的cmake版本比较低(默认为2.8),这里我们从源码编译高版本cmake: 先卸载电脑上安装的cmake (如何已安装的话): sudo apt-get autorem ...
- HTML、CSS规范
作为一名前端开发者,至少要对HTML.CSS规范有个了解,然后尝试在项目是使用,以便别人阅读你代码的时候,也相对轻松点. HTML.CSS规范,参见:编码规范 by @mdo JavaScript 参 ...