在mongoDB中什么被视为文档? [英] What is considered as a document in mongoDB?
问题描述
过去两天我一直在学习mongoDb,我一直对文档及其限制以及如何克服这些限制感到困惑.文档和馆藏之间有什么区别.
I have been learning mongoDb for past two days,I've been confusing with documents and their limits,and how to overcome the limits.What is a differnce between documents and collection.
推荐答案
要将其与传统的RDBMS进行粗略比较:
To roughly compare it with a traditional RDBMS:
RDBMS | MongoDB
_________________________________________
Database | Database
Table | Collection
Tuple/Row | Document
column | Field
Primary Key | Primary Key (Default key _id provided by mongodb itself)
过程:
Database Server(Daemon process) and Client
Mysqld/Oracle | mongod
mysql/sqlplus | mongo
mongos
是在分片和/或副本集方案中的负载平衡期间使用的mongo服务器.
mongos
is the mongo server used during load balancing in a sharding and/or replica set scenario.
因此在mongodb中,数据库由文档集合组成,每个文档包含任意数量的键值对.
Hence in mongodb, database consists of collections of documents and each document contains any number of key value pairs.
同一集合中的不同文档可以具有不同数量和类型的键.您可以说它没有架构;最基本的部分是:一切都基于从哈希值或键的哈希索引中检索值.
Different documents in the same collection can have different number and type of keys. You can say its schema-less; at the most basic part: everything is based on retrieving values from hash values or hash indices of keys.
在文档中,键的值可以从普通原始数据类型(字符串,整数,二进制数据等)到文档和数组.
Within a document, keys can have values ranging from normal primitive datatypes(string, int, binary data etc) to documents and arrays.
对于文档限制大小,由于mongodb以二进制JSON(BSON
)压缩格式存储数据,因此16 MB就足够了.同样,嵌入文档也不会与父文档分开存储,并且会被计入16 MB的限制内.以下是有关文档数量限制的更多链接:
As for the document limit size, 16 MB is sufficient as mongodb stores your data in Binary JSON (BSON
) compressed format. Also embedded documents are not stored separately wrt the parent document and are counted within the 16 MB limit. Here are few more links on document limit:
最新更改的mongodb文档限制
文档限制
链接
决定因素
更多信息
latest change of mongodb document limit
doc limit
link
deciding factor
more info
这篇关于在mongoDB中什么被视为文档?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!