我正在为 MongoDB 创建架构,我有两种用于 Gender 集合的架构。我想知道哪个更适合读取数据(集合可能包含数百万条记录,所以我现在无法实际评估,所以请不要“说尝试样本数据”)
一种是数组类型:
"gender": [{
"GenderType":M/F/U,
"total:logins": 12,
"totaluser": 20,
"newuser": 11
},
{
"GenderType":M/F/U,
"total:logins": 12,
"totaluser": 20,
"newuser": 11
},
{
"GenderType":M/F/U,
"total:logins": 12,
"totaluser": 20,
"newuser": 11
}
]
其次是对象类型。
"gender": {
"male": {
"total:logins": 12,
"totaluser": 20,
"newuser": 11
},
"female": {
"total:logins": 11,
"totaluser": 10,
"newuser": 10
}
"unknown": {
"total:logins": 11,
"totaluser": 10,
"newuser": 10
}
}
优先事项
- 表现
- 贮存
- 可维护性