On Thu, Jan 23, 2014 at 2:35 PM,  <[email protected]> wrote:
> +        mongo = new MongoClient(mongoURI);
> +        db = mongo.getDB(mongoURI.getDatabase());

The database referred in the URI is used by Mongo for determining the
user database against which credentials if passed needs to be
validated.

------------------
/database
Optional. The name of the database to authenticate if the connection
string includes authentication credentials in the form of
username:password@. If /database is not specified and the connection
string includes credentials, the driver will authenticate to the admin
database.
------------------

So far we do not make use of credentials so database field can be
used. But better to manage it in a separate way.

Chetan Mehrotra
[1] http://docs.mongodb.org/manual/reference/connection-string/

Reply via email to