Issues with authenticated connection - Bug in URI parser?

18 views
Skip to first unread message

Otto

unread,
Apr 18, 2012, 10:04:05 AM4/18/12
to scala...@googlegroups.com
Hi,

I'm trying to create an authenticated connection with mongodb and am failing to do so. WIthout authentication everything works fine, I'm using the mongodb uri for that. However, when adding user credentials it doesn't work and I think, that reason lies in how MongoURI parses the string. Here some logger output:

[info] application - Connecting to mongodb: mongodb://foo:bar@localhost:4040/ua with DB: ua
[info] application - username: foo:bar
[info] application - password: [C@6f155f16
[info] application - host: ListWrapper(4040)
[info] application - collection: ua

As you can see, the data isn't set correctly. 

I'm using this command to create the connection 
val c: MongoConnection = MongoConnection(MongoURI(mongoUri)) 

Without user data it works: 
[info] application - Connecting to mongodb: mongodb://localhost:4040/ua with DB: ua
[info] application - username: null
[info] application - password: null
[info] application - host: ListWrapper(localhost:4040)
[info] application - collection: ua

rktoomey

unread,
Apr 18, 2012, 10:19:08 AM4/18/12
to scala-salat
Hi Otto,

I apologise but this is a mailing list for Salat specifically.

Here's a post on the MongoDB users mailing list which I believe
addresses your question:
http://groups.google.com/group/mongodb-user/browse_thread/thread/aeeea7ab51ab8d58/0d152d4eddf6e42a?lnk=gst&q=mongouri#0d152d4eddf6e42a

TL;DR - the expected format is different to the one you are using:
mongodb://uname@password:<HOSTNAME:PORT>/<DB_NAME>.<COLLECTION_NAME>

If that doesn't fix your problem, please try posting your question
directly to mongodb-user:
http://groups.google.com/group/mongodb-user

Thanks,
Rose
Reply all
Reply to author
Forward
0 new messages