如何使用已部署的流星应用程序运行mongo shell脚本? [英] how do you run a mongo shell script with a deployed meteor app?

查看:93
本文介绍了如何使用已部署的流星应用程序运行mongo shell脚本?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用mongo,您可以编写脚本并传递到shell中,例如:

With mongo you can write scripts that get passed into the shell like:

mongo myDB script.js

http://docs.mongodb.org /manual/tutorial/write-scripts-for-the-mongo-shell/

但是要访问已部署的流星应用程序的mongo shell,必须执行以下操作:

but to access the mongo shell of a deployed meteor app is says to do the following:

meteor mongo myApp.meteor.com

我不能像下面这样传递脚本文件:

I can't pass the script file with this statement like so:

 meteor mongo myApp.meteor.com script.js

因为我部署的应用程序受密码保护,并且上面的语句将script.js送入密码提示.

because my deployed app is password protected and the above statement feeds script.js into the password prompt.

所以问题是你会怎么做?

So the question is how would you do this?

或者您如何不使用流星而连接到已部署的流星应用程序的mongo shell?

Alternatively how can you connect to a deployed meteor app's mongo shell without using meteor?

推荐答案

通过meteor mongo myapp.meteor.com --url获取实例的登录详细信息.您将获得与

Get the instance's login details via meteor mongo myapp.meteor.com --url. You'll get something that should match up to

mongodb:// username : password @ host : port / databasename

mongodb://username:password@host:port/databasename

您可以用来通过计算机上的mongo登录.请注意,登录详细信息仅持续1分钟,此时您需要再次meteor mongo --url

Which you can use to login via mongo on your computer. Be aware the login details last for only 1 minute by which time you need to meteor mongo --url again

mongo host:port/databasename -u username -p password yourscript.js

这篇关于如何使用已部署的流星应用程序运行mongo shell脚本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆