mongodb - 带有 symfony 3.4 的 mongodb 地图集
问题描述
我有 symfony 3.4 并使用过 Doctrine MongoDB Bundle
"doctrine/mongodb-odm": "1.1",
"doctrine/mongodb-odm-bundle": "3.4",
我已经在本地安装了 mongo 并与以下配置一起使用,效果很好。
mongodb_server: 'mongodb://mongo:27017'
mongodb_collection: test
doctrine_mongodb:
connections:
default:
server: "%mongodb_server%"
options: {}
default_database: "%mongodb_collection%"
但是现在我尝试访问 mongodb atlas 集群,此时我遇到了以下错误。
MongoClient::__construct(): php_network_getaddresses: getaddrinfo failed: Name or service not known
我试图使用实际凭据作为演示进行访问
mongodb_server: 'mongodb+srv://<username>:<password>@clustertesting.osnmb.mongodb.net/<dbname>?retryWrites=true&w=majority'
mongodb_collection: test
解决方案
推荐阅读
- docker - 在 golang 中导入存档/tar 时 docker run 失败
- applescript - Applescript选择滚动区域中的所有复选框
- java - 当一个项目依赖于其他项目时如何使用gradle构建jar
- android - 应用程序构造通过无法识别的参数在 toolchain.py 中生成错误
- java - unicode-16 中的 nextLine() 和 while 循环错误行为
- reactjs - 如何处理 redux saga 的错误
- javascript - 为什么我会收到“意外使用 'location' no-restricted-globals”?
- python - 在 Python 列表中使用一个字符串两次
- gcc - 为什么 `bool` 数据类型会使我的数据结构对 avr-gdb 不可读?
- python - 将 TriangulatePoints 与 SFM 与 Python 结合使用