Mongodb – Connect to Mongo Shell on OpenShift

mongodb

I have a gear running a instance of mongoDB. I wish to connect to the mongo shell. How can I do it?

I have rhc and mongoDB installed on my computer.

I have RockMongo on the gear, but I cannot create a geospatial index from RockMongo.

I used rhc port-forward whic didn't give any error.

and then tried to connect using the following.

mongo -u<your mongodb user name> -p<the password for mongoDB>  --host <the ip number for mongoDB> --port <the port number> <app name> 

for host I used the localhost address because I have port forward running. Now I can connect but every command i use results in "errmsg" : "unauthorised"

Best Answer

Work Arround

I used PuTTY to connect to the gear and form there I could connect to the mongo shell, and thus solved the issue.


Some Articles that might be helpfull to others.