Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.3k views
in Technique[技术] by (71.8m points)

mongodb - Accessing Meteor production database

To check out what's in the (production) database for blah.meteor.com I thought we would just do:

meteor mongo --url http://blah.meteor.com/

But instead I get a URI:

mongodb://client:984dae4c-04fb-c8bb-68f6-ed83602435cc@skybreak.member1.mongolayer.com:27017/blah_meteor_com

How would I use this URI to access the db?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

You should use meteor mongo http://blah.meteor.com; or even shorter meteor mongo blah.meteor.com.

For documentation you can run meteor help mongo. Extract from running the help command above:

Instead of opening a shell, specifying --url (-U) will return a URL suitable for an external program to connect to the database. For remote databases on deployed applications, the URL is valid for one minute.

So what it's saying is, the url provided by running the command with the --url option is for connecting to the database by some external application, i.e. other than meteor.

UPDATE:

When you connect to MongoDB, you should get a greeting message similar to this:

MongoDB shell version: 2.0.2
connecting to: skybreak.member1.mongolayer.com:27017/userdb_meteor_com

Enter the following command: use userdb_meteor_com (where userdb_meteor_com is taken from the URL in the greeting message above).

To see your collections (usually they refer to collections created in your Meteor app): show collections. You should get something like this:

system.indexes
system.users
users

Now you can run usual commands, e.g.: db.users.find({});.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

2.1m questions

2.1m answers

60 comments

57.0k users

...