I have a domain object model as below...
我有一个域对象模型如下...
@document
Profile
{
**social profile list:**
SocialProfile
{
**Interest list:**
{
Interest
{
id
type
value
}
...
}
...
}
Each profile can have many social profiles, in each social profile there are many interests related to the profile via the specific social profile ( social profile represent social network like Facebook), each interest is also embedded document with the fields id , type , value.
每个简档可以具有许多社交简档,在每个社交简档中,通过特定社交简档(社交简档表示像Facebook这样的社交网络)有许多与简档相关的兴趣,每个兴趣也是具有字段id,类型,值的嵌入文档。
So I have two questions.. can I index few fields separately in the embedded document interest? can I create compound index in the embedded document interest?
所以我有两个问题..我可以在嵌入式文档中单独索引几个字段吗?我可以在嵌入式文档中创建复合索引吗?
I guess the complexity in my model is the deep level of the embedded document which is 2.. and that the path to that document is via arrays...
我想我的模型的复杂性是嵌入式文档的深层次,它是2 ..并且该文档的路径是通过数组...
can it be done in spring way via metadata annotations? if you think my model is wrong please let me know I am a newbie on mongo Thanks
可以通过元数据注释以春季方式完成吗?如果您认为我的模型有误,请告诉我我是mongo的新手谢谢
1 个解决方案
#1
6
You can index separately on the fields in an embedded document.
您可以单独索引嵌入文档中的字段。
You can also create a compound index on the fields, so long as no more than one field is an array.
您还可以在字段上创建复合索引,只要一个数组不超过一个字段即可。
These might offer more answers:
这些可能提供更多答案:
http://www.mongodb.org/display/DOCS/Indexes#Indexes-CompoundKeys
#1
6
You can index separately on the fields in an embedded document.
您可以单独索引嵌入文档中的字段。
You can also create a compound index on the fields, so long as no more than one field is an array.
您还可以在字段上创建复合索引,只要一个数组不超过一个字段即可。
These might offer more answers:
这些可能提供更多答案:
http://www.mongodb.org/display/DOCS/Indexes#Indexes-CompoundKeys