【发布时间】:2017-12-10 11:02:35
【问题描述】:
我正在搞乱 MongoDB,我想知道最好的解决方案是什么:我有一个动物集合,每个动物都有一个名称和一个类型。
但是对于前端需求,每种类型都有一种颜色。
所以有两种可能:
第一个:
Animal
.animal 1
name: Simba
race: lion
type:
name: felin
color: blue
.animal 2
name: Franck
race: turtle
type:
name: turtle
color: red
.animal 3
name: Francis
race: turtle
type:
name: turtle
color: red
第二:
Animal
.animal 1
name: Simba
race: lion
type: (id of type collection)
Type
.type 1
name: felin
color: blue
.type 2
name: turtle
color: red
那么,我应该复制数据吗?还是我应该创建一个新集合?
感谢您的宝贵时间!
【问题讨论】:
标签: mongodb performance nosql