使用Python Eve API和MongoDB Atlas清空GET响应

使用Python Eve API和MongoDB Atlas清空GET响应,mongodb,eve,Mongodb,Eve,我目前正在使用MongoDB Atlas,我正在尝试在云端测试之前,看看是否可以通过Eve本地访问数据。我在settings.py中有以下内容: MONGO_DBNAME = "Nintendo" MONGO_URI = "mongodb+srv://user:password@xyz.gcp.mongodb.net/test?retryWrites=true&w=majority" Games = { 'schema': { "Name": {'type':

我目前正在使用MongoDB Atlas,我正在尝试在云端测试之前,看看是否可以通过Eve本地访问数据。我在settings.py中有以下内容:

MONGO_DBNAME = "Nintendo"
MONGO_URI = "mongodb+srv://user:password@xyz.gcp.mongodb.net/test?retryWrites=true&w=majority"

Games = {
    'schema': {
        "Name": {'type': 'string'},
        "Year": {'type': 'number'}
    }
}


DOMAIN = {
    "Games": Games
}
我在“游戏”系列中有以下演示数据:

当我使用查询演示数据时,我没有得到匹配的文档,而我希望有两个。具体而言,我得到以下回应:

<resource href="Games" title="Games">
   <link rel="parent" href="/" title="home"/>
   <_meta>
      <max_results>25</max_results>
      <page>1</page>
      <total>0</total>
   </_meta>
</resource>

25
1.
0
通过使用PyMongo驱动程序连接到MongoDB Atlas,我检查了URI是否正确,还检查了DB和集合名称是否正确。你知道在这种情况下会发生什么吗?谢谢大家!

通过,我发现URI试图访问测试数据库,而不是游戏数据库。我相信这种情况自那以后就发生了。我刚刚将上面的URI链接从“mongodb”更改为+srv://user:password@xyz.gcp.mongodb.net/test?retryWrites=true&w=多数“到”mongodb+srv://user:password@xyz.gcp.mongodb.net/Games?retryWrites=true&w=多数”。现在它工作了

<resource href="Games" title="Games">
   <link rel="parent" href="/" title="home"/>
   <_meta>
      <max_results>25</max_results>
      <page>1</page>
      <total>0</total>
   </_meta>
</resource>