[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: |
|
||||
| Description |
|
In the javadoc, it's explained that I can connect to MongoDB with a DBAddress, like this:
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. | ||||
| Comment by auto [ 22/Nov/10 ] | ||||
|
Author: {'login': 'erh', 'name': 'Eliot Horowitz', 'email': 'eliot@10gen.com'}Message: test for | ||||
| 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:
And I think the bug is on the documentation, not the code. See http://github.com/mongodb/mongo-java-driver/pull/13 |