File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -673,13 +673,10 @@ public DBCollection getCollection(){
673673
674674 /**
675675 * Gets the Server Address of the server that data is pulled from.
676- * Note that this information is not available if no data has been retrieved yet.
677- * Availability is specific to underlying implementation and may vary.
676+ * Note that this information may not be available until hasNext() or next() is called.
678677 * @return
679678 */
680679 public ServerAddress getServerAddress () {
681- _check ();
682-
683680 if (_it != null && _it instanceof DBApiLayer .Result )
684681 return ((DBApiLayer .Result )_it ).getServerAddress ();
685682
Original file line number Diff line number Diff line change @@ -63,6 +63,7 @@ public void testGetServerAddressQuery() {
6363 for (int i =0 ; i < 10 ; i ++) c .insert (new BasicDBObject ("one" , "two" ));
6464
6565 final DBCursor cur = c .find ();
66+ cur .hasNext ();
6667 assertNotNull (cur .getServerAddress ());
6768 }
6869
@@ -76,6 +77,7 @@ public void testGetServerAddressQuery1() {
7677 for (int i =0 ; i < 10 ; i ++) c .insert (new BasicDBObject ("one" , i ));
7778
7879 final DBCursor cur = c .find (new BasicDBObject ("one" , 9 ));
80+ cur .hasNext ();
7981 assertNotNull (cur .getServerAddress ());
8082 }
8183
You can’t perform that action at this time.
0 commit comments