如何索引嵌入文档的字段

How to index field of embedded document

我有 class User 嵌入 class SocialSocial 具有属性 vkfb,所以我的结构类似于:

User {
   @class: User
   social: {
        @class : Social
        "vk":"123",
        "fb":"456"
    }
}

如何创建索引,我可以在 select 上使用它:select from User where social.vk = '123'

索引是为 class 的属性创建的,而不是为嵌入的属性创建的,所以这是不可能的。

我们可以创建两个单独的 class UserSocial 以及索引:

create class User
create class Social

create property Social.vk string
create property User.social LINK Social

create index User.social unique
create index Social.vk unique

现在select from User where social.vk = '123'使用索引

如果我错了,请告诉我。