如何告訴eve REST框架使用不同的mongodb集合而不是資源名作為集合名

2024-10-03 13:24:05 发布

您现在位置:Python中文网/ 问答频道 /正文

通常,如果我们在域配置中没有为'source'fieid指定值,pythoneve框架将创建mongodb集合作为资源名。你知道吗

但是,如果要使用不同的名称而不是资源名称创建mongodb集合,我需要更改的eve配置是什么?你知道吗

致以最诚挚的问候, 纳伦德拉


Tags: 名称框架sourcemongodb资源eve问候pythoneve
1条回答
网友
1楼 · 发布于 2024-10-03 13:24:05

docs

source: Name of the database collection consumed by the resource. If omitted, the resource name is assumed to also be a valid collection name.

所以,看起来datasource.source就是您要查找的设置。像这样:

endpoint = {
    'datasource': {
        'source': "mycollectioname"
    }
}

相关问题 更多 >