Install Mongo directly on your machine, not through Meteor. Make sure you’re running the latest version (3.x).
Run the command meteor mongo --url XXX.meteor.com to get the Mongo database to connect to.
Pass that Mongo database directly to the mongo command (not the meteor mongo command). Note that the argument passed to mongo has a different format than what meteor mongo --url returns. Here’s a short script that will automate the conversion process (on Mac or Linux, or Windows with sed installed):
mongo `meteor mongo --url XXX.meteor.com | sed 's/mongodb:\/\//-u /' | sed 's/:/ -p /' | sed 's/@/ /'`
Why is this happening?
New apps deployed with meteor deploy as of about a week ago get a Mongo database from mongodirector.com (this was done to help with the Mongo hosting problems we were hitting). These new Mongo databases are running Mongo 3.0. meteor mongo runs Mongo shell 2.6.7, which can’t connect to Mongo 3.0 instances.
We’ll probably release patch updates to Meteor (potentially to every recent major release). But in the meanwhile the workaround described above should work.
In windows you must use double quotes instead of single quotes. So is:
mongo meteor mongo --url XXX.meteor.com | sed "s/mongodb:\/\//-u /" | sed "s/:/ -p /" | sed "s/@/ /"
Can use echo "(url printed for meteor mongo --url xxx.meteor.com)" | sed "s/mongodb:\/\//-u /" | sed "s/:/ -p /" | sed "s/@/ /"
So now you will have printed the url and you can just enter mongo (data printed by echo command) and connected!
This workaround is challenging to use: installing mongodb 3 on a 32-bit dev machine is not easy as there are no packages for v3 on 32bit. You have to find the legacy version and install it manually. Go here and choose 32 bit legacy from the version dropdown:
Once you’ve done that, you can restore etc as you did previously except that you need to make sure you’re running v3, not your Meteor v2. So preface your ‘mongorestore’ with the path to the new version, for example:
This workaround isn’t working for me. I’m still getting the “login failed” exception.
I’m new to Meteor and not sure how to access the deployed website’s MongoDB. I’ve used meteor login to login to meteor before doing the instructions you’ve posted, but to no avail.
Not working for me also… I put in the converted string below in the MongoDB shell, and I get the Syntax Error: missing ; does the string look right? thank you
I managed to fix this by reinstalling the latest version of Mongo shell. I believe I had a 2.x (2.6?) version installed originally, and the workaround here only worked for me after I upgraded the Mongo shell to 3.x.
Instead of manually installing Mongodb 3.x, which isn’t very well supported on 32 bit machines, I found it easier to use a GUI such as MongoChef to connect to my database on meteor.com. Note that RoboMongo won’t work because it hasn’t been updated for Mongo shell 3.x.
wow!! thanks much kwatson… yeah per the GTS Developer Blog post, MongoChef works very well. there’s even a New Connection feature where just type in the URI and it does it everything else.