Equivalent of ERD for MongoDB?

2019-02-07 17:11发布

What would be the equivalent of ERD for a NoSQL database such as MongoDB?

5条回答
不美不萌又怎样
2楼-- · 2019-02-07 17:38
【Aperson】
3楼-- · 2019-02-07 17:44

I know of no standard means of diagramming document-oriented "schema".

I'm sure you could use an ERD to map out your schemata but since document databases do not truly support--or more importantly enforce--relationships between data, it would only be as useful as your code was disciplined to internally enforce such relationships.

查看更多
forever°为你锁心
4楼-- · 2019-02-07 17:46

It looks like you asked a similar question on Quora.

As mentioned there, the ERD is simply a mapping of the data you intend to store and the relations amongst that data.

You can still make an ERD with MongoDB as you still want to track the data and the relations. The big difference is that MongoDB has no joins, so when you translate the ERD into an actual schema you'll have to make some specific decisions about implement the relationships.

In particular, you'll need to make the "embed vs. reference" decision when deciding how this data will actually be stored. Relations are still allowed, just not enforced. Many of the wrappers for MongoDB actually provide lookups across collections to abstract some of this complexity.

Even though MongoDB does not enforce a schema, it's not recommended to proceed completely at random. Modeling the data you expect to have in the system is still a really good idea and that's what the ERD provides you.

So I guess the equivalent to the ERD is the ERD?

查看更多
\"骚年 ilove
5楼-- · 2019-02-07 17:52

You could just use a UML class diagram instead too.

查看更多
兄弟一词,经得起流年.
6楼-- · 2019-02-07 17:54

I have been thinking about the same issue for quite some time. And I came to the following conclusion: If NoSQL databases are generally schemaless, you don't actually have a 'schema' to illustrate in a diagram.

Thus, I think you should take a "by example" approach. You could draw some mindmaps exemplifying how your data would look like when stored in a NoSQL DB such as MongoDB.

And since these databases are very dynamic you could also create some derived mindmaps to show how the data from today could evolve in time.

Take a look at this topic too.

Confusion about NoSQL Design

查看更多
登录 后发表回答