admin管理员组文章数量:1312911
With mongo you can write scripts that get passed into the shell like:
mongo myDB script.js
/
but to access the mongo shell of a deployed meteor app is says to do the following:
meteor mongo myApp.meteor
I can't pass the script file with this statement like so:
meteor mongo myApp.meteor 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?
Alternatively how can you connect to a deployed meteor app's mongo shell without using meteor?
With mongo you can write scripts that get passed into the shell like:
mongo myDB script.js
http://docs.mongodb/manual/tutorial/write-scripts-for-the-mongo-shell/
but to access the mongo shell of a deployed meteor app is says to do the following:
meteor mongo myApp.meteor.
I can't pass the script file with this statement like so:
meteor mongo myApp.meteor. 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?
Alternatively how can you connect to a deployed meteor app's mongo shell without using meteor?
Share Improve this question asked Jun 9, 2013 at 8:37 funkyeahfunkyeah 3,1946 gold badges32 silver badges48 bronze badges2 Answers
Reset to default 8Get the instance's login details via meteor mongo myapp.meteor. --url
. You'll get something that should match up to
mongodb://username
:password
@host
:port
/databasename
Which you can use to login via mongo
on your puter. 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
Expanding a bit on Akshat's answer. The URI string that meteor mongo --url
puts out is a MongoDB Connection String. It is a bit surprising that the mongo shell itself does not support this format. This has been reported as a bug; also see this Stack Overflow answer.
It would be nice if meteor mongo
had a way of passing parameters unparsed directly to the mongo shell. Following a mon Unix idiom it could've be something like:
meteor mongo myapp.meteor. -- myscript.js --some-other-mongo-parameter
But that does not work (I submitted a feature request).
I wrote a convenience wrapper for all the mongo client shell mands. You can install it with NPM:
npm install -g mmongo
If you don't use NPM, it's just a single file to drop somewhere in your $PATH
; see the README at Github.
You can now do:
mmongo myapp.meteor. myscript.js
Also see this answer for some examples.
(There was previously a less featured script in Ruby here; see this Gist.)
本文标签: javascripthow do you run a mongo shell script with a deployed meteor appStack Overflow
版权声明:本文标题:javascript - how do you run a mongo shell script with a deployed meteor app? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741880790a2402732.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论