Python-Eve中的可嵌入数组类型模式

0 投票
1 回答
824 浏览
提问于 2025-04-17 21:05

我知道我们可以把一个资源嵌入到另一个资源里,不过下面这个结构好像不太管用?那要怎么才能把一组资源嵌入到另一个资源里呢?

outer = {
   'type': 'dict',
   'schema': {
       'inner': {
           'type': 'list',
            'schema': {
                'type': 'objectid',
                'required': True,
                'data_relation': {
                    'resource': 'other_resources',
                    'embeddable': True,
            },
        },
    },
   }
}

1 个回答

0

目前不支持:

现在我们只支持一层嵌套,也就是说像 /emails?embedded={"author": 1} 这样的请求是可以的,但像 /emails?embedded={"author.friends": 1} 这样的请求就不行。

不过,现在有一个正在进行中的请求(添加对两层文档嵌套的支持),试图解决这个问题。

撰写回答