auth fails: Connect to other then default DB in Op

2019-06-09 17:55发布

问题:

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'

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

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