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.
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"
}
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.
原文:http://www.cnblogs.com/chucklu/p/6480192.html