auth fails: Connect to other then default DB in OpenShift?

佐手、 提交于 2020-01-14 05:41:06

问题


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?

来源:https://stackoverflow.com/questions/30337433/auth-fails-connect-to-other-then-default-db-in-openshift

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!