【发布时间】:2019-11-29 05:21:12
【问题描述】:
我目前正在使用 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
}
我在“游戏”集合下有以下演示数据:
{"Name":"Legend of Zelda: Breath of the Wild","Year":2017}
{"Name":"Luigi's Mansion","Year":2001}
当我使用http://localhost:1234/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>
我通过使用 PyMongo 驱动程序连接到 MongoDB Atlas 来检查 URI 是否正确,并且我还检查了 DB 和 Collection 名称是否正确。知道在这种情况下发生了什么吗?谢谢!
【问题讨论】: