After adding of the MongoDB cartridge to your application, you will get a message like this:
mongodb-2.4 (MongoDB 2.4)
-------------------------
Gears: 1 small
Connection URL: mongodb://$OPENSHIFT_MONGODB_DB_HOST:$OPENSHIFT_MONGODB_DB_PORT/
Database Name: <your_application_name>
Password: <generated_password>
Username: admin
The problem is to find the value of OPENSHIFT_MONGODB_DB_HOST and OPENSHIFT_MONGODB_DB_PORT.
Follow steps will help you:
1. Build connection to your application:
rhc app ssh -a <your_application_name>
2. show environment variables, which names contain MONGODB
env | grep MONGODB