0

Am I allowed to use other MongoDB database in OpenShift or just the default one indicated in web interface?

Somehow I created a database called Memrise, but it seems I don't have access to DB called 'Memrise' from Node.js only from MongoDB client, but I can connect to DB called 'nodesjs'.

this is the connection string used in Node.js

mongodb://admin:xxx@127.8.202.130:27017/Memrise
Db open error: auth fails

here is how I try to connect:

console.log(connection_string + '/' + req.params.db);
         connection.connect(connection_string + '/' + req.params.db, function (err, db) {

                            if (err) {
                            //logger.error('Db open error: ' + err.message);
                            console.log('Db open error: ' + err.message);
                            res.status(500).json({ message: 'Server error' });
                            return;
                            }

web interface about MongoDB, you can see the 'default' DB is called 'nodejs' enter image description here

and here are all the DBs able to see in MongoDB client, 'Memrise' is in list:

enter image description here

So am I able to access other DB in OpenShift or only default one?

János
  • 32,867
  • 38
  • 193
  • 353
  • authenticate to the database where the user was created, you can switch then: http://stackoverflow.com/a/26428737/239219 – János May 20 '15 at 09:28
  • solution here: http://mongodb.github.io/node-mongodb-native/2.0/tutorials/connecting/ **Indirectly Against Another Database** need `'?authSource=admin'` at the end of the connection string – János May 20 '15 at 13:14
  • For what it's worth you can also use RockMongo to admin your OpenShift MongoDB instance: https://hub.openshift.com/addons/29-rockmongo – luciddreamz May 20 '15 at 16:24

0 Answers0