I want to connect to a mongo database which has authentication enabled.
There is an admin user (to give rights) and within my database, there is a
user which has rights to read and write.

at the mongo console, I can login to the database and do queries, e.g.

MBP-Sabine:~ sabine$ /Users/sabine/Documents/Mongodb3_4_1/bin/mongo
MongoDB shell version v3.4.1
connecting to: mongodb://127.0.0.1:27017
MongoDB server version: 3.4.1
"tell mongo to use spesenfuchs database"
> use spesenfuchs
switched to db spesenfuchs

"ask for number of trips -> error because no rights"
> db.Trips.find().size();
2017-01-07T15:39:47.784+0100 E QUERY    [main] Error: count failed: {
    "ok" : 0,
    "errmsg" : "not authorized on spesenfuchs to execute command { count:
\"Trips\", query: {}, fields: {} }",
    "code" : 13,
    "codeName" : "Unauthorized"
} :
_getErrorWithCode@src/mongo/shell/utils.js:25:13
DBQuery.prototype.count@src/mongo/shell/query.js:383:11
DBQuery.prototype.size@src/mongo/shell/query.js:387:12
@(shell):1:1

"I login with my database user"
> db.auth("sasu_work", "xxxxx")
1

"now, I can access the database and do queries"
> db.Trips.find().size();
203
>

I thouhgt, that I can do the same within Pharo with
    (VOMongoRepository host: 'localhost' database: self databaseName
username: 'sasu_work' password: 'xxxxx') enableSingleton.

And them access my objects from mongo…But this does not work... I geht the
error:
"MongoQueryError: not authorized for query on spesenfuchs.ExchangeRates"

Is there something missing, what I have to do? I hope so

Or is it possibly this problem (?authMode=scram-sha1):
http://stackoverflow.com/questions/23619018/mongodb-not-authorized-for-query-code-13



--
View this message in context: 
http://forum.world.st/Mongo-voyage-connect-to-database-with-authentication-fails-tp4929013.html
Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com.

Reply via email to