MongoDB关系
拜托,你能说我,觉得我好还是坏?
我有两个对象,Exhibition
和 Stand
。在我的逻辑中,Exhibition
has_many Stands
。 我想使用 mongodb。首先,我可以做嵌入展览的展台。但多个展览可以包含同一个展位。之后我认为,最好创建两个文档(集合):Exhibition
和 Stand
并模仿关系引用。
1.Is it good idea?
如果这是个好主意,我会在展览文档字段stand_ids中创建,该字段将是数组,我将在该字段中推送必要的展位ID。
2.When i push ids in Exhibition and after this i
want to delete reference stand in Stands document.
How will be better to destroy id in Exhibition.stand_ids.
3.Think i by relational or it is good practice?
Please, can you say me, think i good or bad?
I have two objects, Exhibition
and Stand
. In my logic Exhibition
has_many Stands
.
I want to use mongodb. First, i can do Stand embedded in Exhibition. But several exhibitions can include same stand. After this i think, that will be better to create two documents(collections): Exhibition
and Stand
and imitate relation references.
1.Is it good idea?
If it is good idea, than i create in Exhibition document field stand_ids, which will be array and i will push in this field necessary stand ids.
2.When i push ids in Exhibition and after this i
want to delete reference stand in Stands document.
How will be better to destroy id in Exhibition.stand_ids.
3.Think i by relational or it is good practice?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
如果您正在处理关系,则应该使用关系数据库。如果您的数据具有结构,那么使用 noSQL 解决方案就没有意义。
我给您的建议是使用最适合该工作的工具。您尝试做的事情似乎对于关系数据库来说是理想的。
If you're working with relations you should use a relational DB. It doesn't make sense to use a noSQL solution if your data has structure.
My advice to you would be to use the tool most suited for the job. What you're trying to do seems to be ideal for a relational DB.
在每个类中使用上述关系。
use above relationship in each of the class.
我认为这篇文章适合您 http://www.mongodb.org/display/ DOCS/架构+设计
用例
客户/订单/订单行项目
博客系统。
架构设计基础知识
Kyle Banker,10gen
索引&查询优化
Alvin Richards,企业工程高级总监
*这 2 个视频是 mongoddb 上见过的最好的视频
I think this post will be right for you http://www.mongodb.org/display/DOCS/Schema+Design
Use Cases
Customer / Order / Order Line-Item
Blogging system.
Schema Design Basics
Kyle Banker, 10gen
Indexing & Query Optimization
Alvin Richards, Senior Director of Enterprise Engineering
*These 2 videos are the bests on mongoddb ever seen imho