[JAVA-201] new Mongo with a DBAddress Created: 25/Oct/10  Updated: 22/Dec/10  Resolved: 22/Nov/10

Status: Closed
Project: Java Driver
Component/s: None
Affects Version/s: 2.2
Fix Version/s: 2.4

Type: Bug Priority: Major - P3
Reporter: Bruno Michel Assignee: Eliot Horowitz (Inactive)
Resolution: Cannot Reproduce Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related

 Description   

In the javadoc, it's explained that I can connect to MongoDB with a DBAddress, like this:

Mongo mongo3 = new Mongo( new DBAddress( "127.0.0.1:27017", "test" ) )

But, the IP address in the DBAddress is ignored, and the connection is always made to 127.0.0.1:27017.



 Comments   
Comment by Eliot Horowitz (Inactive) [ 22/Nov/10 ]

I added a test for exactly your case and its working exactly as the docs say.
Can you send the code your'e using and how its failing?

Comment by auto [ 22/Nov/10 ]

Author:

{'login': 'erh', 'name': 'Eliot Horowitz', 'email': 'eliot@10gen.com'}

Message: test for JAVA-201
/mongodb/mongo-java-driver/commit/91e73121a2dc471ada6884e2c7fa5213c1580b6c

Comment by Alvin Richards (Inactive) [ 05/Nov/10 ]

Potential workaround.

You can also pass a List of ServerAddress in to the Mongo() constructor. The ServerAddress constructor takes an address and part and connects to non-default ports just fine.

Comment by Bruno Michel [ 26/Oct/10 ]

In fact, it's not the IP address that is ignored, but the port:

    public DBAddress( String host , String dbname )
        throws UnknownHostException {
        this( host , DBPort.PORT , dbname );
    } 

And I think the bug is on the documentation, not the code. See http://github.com/mongodb/mongo-java-driver/pull/13

Generated at Thu Feb 08 08:51:43 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.