2

我是 KeystoneJs 的新手,我想Type.Relationship使用 mongoosastic 在弹性搜索中索引 a。问题在于 Mongo 数据Type.Relationship存储为 ObjectID 数组 - 而不是实际关系的值 - 因为每个可能有多个(categories参见platform下文

{
    "_id" : ObjectId("56d49e8ebe469b9614119259"),
    "slug" : "philips-hue",
    "title" : "Philips Hue",
    "categories" : [ 
        ObjectId("56d4a03abe469b961411925a"), 
        ObjectId("56d4a047be469b961411925b")
    ],
    "state" : "published",
    "__v" : 3,
    "author" : ObjectId("56d499ad995a533813adef63"),
    "publishedDate" : ISODate("2016-02-29T13:00:00.000Z"),
    "manufacturer" : ObjectId("56d5eeec1ffcbb0517f07e1b"),
    "platform" : [ 
        ObjectId("56d5ee0ab85dbdf916007009"), 
        ObjectId("56d5ee37b85dbdf91600700a"),
        ObjectId("56d5ee34uj3i223io23h2394")
    ]
}

这些ObjectIds 的platform格式为:

{
    "_id" : ObjectId("56d5ee0ab85dbdf916007009"),
    "key" : "homekit",
    "name" : "Homekit",
    "__v" : 0
}

谁能把我放在正确的路径上以添加到name引用的 ObjectIds 的弹性搜索索引中?

4

0 回答 0