MongoDB真的是无模式的吗?

By now it is well known that the MongoDB is Schemaless. We need to understand what is that makes the MongoDB beahve as a schemaless database.

到目前为止,众所周知MongoDB是无模式的。 我们需要了解什么使MongoDB成为无模式数据库。

Every RDBMS database will possess a structure with respect to persisting the data. So, when the database needs to be modified, say a column of particular table needs to be modified(changing the datatype) or adding/removing a column from a table, we have to mention, what type of data this column will hold.

每个RDBMS数据库都将具有持久存储数据的结构。 因此,当需要修改数据库时,比如说需要修改特定表的一 (更改数据类型)或从表中添加/删除一列,我们不得不提一下,该列将保存哪种数据类型。

But, MongoDB is a document based database, which does not use the concept of tables and columns, instead of which it uses the concept of documents and collections. All the referential data with respect to different modules will be stored as one collection. More over the BSON data structure used by MongoDB can easily have varying sets of data and fields with different types.

但是,MongoDB是基于文档的数据库,它不使用表和列的概念,而是使用文档和集合的概念。 关于不同模块的所有参考数据将存储为一个集合。 MongoDB使用的BSON数据结构更多,可以轻松拥有具有不同类型的数据和字段的不同集合。

When we say schemaless, we actually mean dynamically typed schema, as opposed to statically typed schemas as available in RDBMS(SQL) databases.

当我们说无模式时 ,实际上是指动态类型的模式 ,而不是RDBMS(SQL)数据库中可用的静态类型的模式。

JSON is a completely schema free data structure, as opposed to XML which allows you to specify XSD if you need.

JSON是完全无模式的数据结构,与XML相反,XML允许您在需要时指定XSD。

Whenever we store something in MongoDB, we know what we are storing, its a String, Int or a custome Object in JSON format, and as soon as we try to store it in a collection, MongoDB accepts it as a JSON formatted data.

每当我们将某些内容存储在MongoDB中时,我们都知道要存储的内容,即JSON格式的String,Int或custome对象,一旦尝试将其存储在集合中,MongoDB就会将其接受为JSON格式的数据。

And when you read somewhere that data migration is easy in NoSQL databases, its also not absolutely true. There are certain scenarios where document based databases like MongoDB proves to be better, but there are scenarios where SQL based databases have the upper hand. For example : data processing while migrating, takes longer in case of NoSQL due to data duplication, while in a Normalised SQL database, minimal data duplication is there.

而且,当您在NoSQL数据库中读到数据迁移很容易的地方时,它也不是绝对正确的。 在某些情况下,诸如MongoDB之类的基于文档的数据库被证明是更好的,但是在某些情况下,基于SQL的数据库占据了上风。 例如:迁移时的数据处理,由于数据重复而在NoSQL情况下花费的时间更长,而在规范化SQL数据库中,那里的数据重复最少。

翻译自: https://www.studytonight.com/mongodb/is-mongodb-really-schemaless

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值