MongoDB:如何在论文中表示模式图? [英] MongoDB: How to represent a schema diagram in a thesis?

查看:132
本文介绍了MongoDB:如何在论文中表示模式图?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在写论文,需要在图表中显示我的MongoDB的架构.我没有找到有关基于文档的数据库图的资源.

有用于关系数据库的实体关系图(ERD).我对MongoDB有什么选择?我注意到,很多博客只是将原始JSON显示为它们的关系图",但这在我的论文中是不可行的.

这是我的JSON结构之一的示例:

//MultiChoiceQuestion
{
    "title": "How are you?",
    "valid_answers" : [
        {
            "_id" : ObjectID(xxxx),
            "title": "Great",
            "isCorrect": true,
        },
        {
            "_id" : ObjectID(yyyy),
            "title": "OK",
            "isCorrect": false,
        },
        {
            "_id" : ObjectID(zzzz),
            "title": "Bad",
            "isCorrect": false,
        }
    ],
    "user_responses" : [
        {
            "user": ObjectID(aaaa),
            "answer": ObjectID(xxxx)
        },
        {
            "user": ObjectID(bbbb),
            "answer": ObjectID(xxxx)
        },
        {
            "user": ObjectID(cccc),
            "answer": ObjectID(yyyy)
        }
    ]
}

//User
{
    "_id": ObjectID(aaaa),
    "name": "Person A"
}
//User
{
    "_id": ObjectID(bbbb),
    "name": "Person B"
}
//User
{
    "_id": ObjectID(cccc),
    "name": "Person C"
}

这可能是一个示意图:

解决方案

我们发现类图实际上是表示mongo模式设计的最佳方法之一.

它可以捕获文档将具有的大多数项目,例如数组,嵌入式对象甚至引用.

我们用于与uml概念相关的一般准则

嵌入 =合成聚合

参考 =关联类

如果您不熟悉uml术语,那么这是不错的介绍.

IBM网站的UML简介

I am currently writing a thesis and need to display the schema of my MongoDB in a diagram. I have found no resources about diagrams for document-based databases.

There are Entity Relationship Diagrams (ERD) for relational databases. What options do I have for MongoDB? I've noticed that a lot of blogs just display the raw JSON as their "diagram" but this isn't feasible in my thesis.

Here is a sample of one of my JSON structures:

//MultiChoiceQuestion
{
    "title": "How are you?",
    "valid_answers" : [
        {
            "_id" : ObjectID(xxxx),
            "title": "Great",
            "isCorrect": true,
        },
        {
            "_id" : ObjectID(yyyy),
            "title": "OK",
            "isCorrect": false,
        },
        {
            "_id" : ObjectID(zzzz),
            "title": "Bad",
            "isCorrect": false,
        }
    ],
    "user_responses" : [
        {
            "user": ObjectID(aaaa),
            "answer": ObjectID(xxxx)
        },
        {
            "user": ObjectID(bbbb),
            "answer": ObjectID(xxxx)
        },
        {
            "user": ObjectID(cccc),
            "answer": ObjectID(yyyy)
        }
    ]
}

//User
{
    "_id": ObjectID(aaaa),
    "name": "Person A"
}
//User
{
    "_id": ObjectID(bbbb),
    "name": "Person B"
}
//User
{
    "_id": ObjectID(cccc),
    "name": "Person C"
}

Could this be a possible diagram:

解决方案

We found class diagrams to actually be one of the best ways to represent a mongo schema design.

It can capture most of the items that a document will have such as arrays, embedded objects and even references.

General guidelines we use to relate onto concepts to uml

Embed = Composition aggregation

Reference = Association class

If you're unfamiliar with the uml terminology then this is a decent intro.

UML intro from IBM site

这篇关于MongoDB:如何在论文中表示模式图?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆