问题描述
如何将 Robomongo(或任何其他 mongodb 客户端)连接到由我的本地 Meteor 应用程序创建的 mongodb 实例?
How can I connect Robomongo (or any other mongodb client) to the mongodb instance that is created by my local Meteor application?
推荐答案
确保 Meteor 在本地主机上运行.打开终端窗口并运行 meteor
命令.如果您没有更改为端口,它将开始在 localhost:3000 上运行.
Ensure Meteor is running on localhost. Open a terminal window and run meteor
command. It will start running on localhost:3000 if you have not changed to port.
在运行时,打开一个单独的终端窗口并运行 meteor mongo
命令.这将打开一个 MongoDB shell 并告诉您它连接到哪个端口.从 0.7.1.1 版本开始,通常为 3001 或 3002(如果更早).它会说类似 127.0.0.1:3001/meteor
While it is running, open a separate terminal window and run meteor mongo
command. This will open up a MongoDB shell and tell you what port it is connecting to This is normally 3001 as of version 0.7.1.1 or 3002 if earlier. It will say something like 127.0.0.1:3001/meteor
转到 Robomongo(或您最喜欢的 mongodb 客户端软件)并创建一个新连接,确保将连接地址更改为 localhost 和给定的端口号.如果您的客户不坚持使用默认数据库,则无需额外定义/meteor.
Go to Robomongo (or your favorite mongodb client software) and create a new connection, making sure to change the connection address to localhost and the given the port number. No need to additionally define /meteor if your client does not insist on a default database.
也如 https://stackoverflow.com/a/22023284/1064151 中指出的一些驱动程序可能需要特定的行尾、分隔符或其他字符流.例如,ObjCMongoDB 基于 C 的驱动程序希望 url 为 127.0.0.1:3001/
最后加上那个额外的 /
,否则它不会工作.因此,请务必查看驱动程序/客户端的文档.
Also as pointed out in https://stackoverflow.com/a/22023284/1064151 some drivers may need specific line endings, delimeters or other character flow. For example, ObjCMongoDB a C based driver wants the url to be 127.0.0.1:3001/
with that extra /
at the end, or it won't work. So make sure you check the documentation for your driver/client.
这篇关于如何将 mongodb 客户端连接到本地 Meteor MongoDB的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!