【发布时间】:2016-03-25 22:11:56
【问题描述】:
在类图(UML 格式)中绘制 mongodb 架构图是否可行,因为 ER 图更多地与 SQL 相关。
-
在高层schema中表示id时,以下3个中哪个类型正确:(int or objectId or _id)
id: int或
id: bson.ObjectId或
id: _id -
在架构图中表示子文档对象时,以下2个中哪个类型正确(字符串或对象)
comments : String [ { userName : String date : String actualComment : String } ]或
comments : Object [ { userName : String date : String actualComment : String } ]
更新
如果我有以下子文档(这里是 JSON 表示),Mongo 如何存储回复 - 它是什么类型?
comments : String [
{
userName : String
date : String
actualComment : String
replies : comment [ ] // how does mongo store nested replies
}
]
【问题讨论】:
-
_id 隐含地是每个文档的一部分。因此,您可能会考虑省略它,除非您将其替换为特定于应用程序的值。
-
@Philipp 问题是什么类型。
_id是隐式字段,但类型是ObjectId。 -
回复和cmets怎么样。在 JSON 中,回复采用评论类型,但它在 mongo 中是如何表示的?
标签: mongodb