I tried using the documented format for the URI :
But got an "String index out of range" error in line 69 of MongoUri-class. Upon examining the code, I see the problem :
if ( serverPart.indexOf( "@" ) > 0 )
{ int idx = serverPart.indexOf( "@" ); _username = serverPart.substring( 0 , idx ); serverPart = serverPart.substring( idx + 1 ); idx = serverPart.indexOf( ":" ); Line 69 : _password = serverPart.substring( 0 , idx ).toCharArray(); serverPart = serverPart.substring( idx + 1 ); }In the above, I am guessing the problem is two-fold.
1) In retrieving the password, you are using "serverPart" instead of "_username" . But now the "serverPart" parameter holds everything behind "@".
2) No check that idx>0. Which may be right, since this would after all be a fault on the developer (maybe, depending upon the usage).
In the above code, using "serverPart" instead of "_username", the correct usage would be :
mongodb://<username>@<password>:<server>/<db-name>.<db-collection>
But I am guessing this is wrong. I have tried the above, and see that this does not throw an exception.