File tree Expand file tree Collapse file tree 2 files changed +21
-1
lines changed Expand file tree Collapse file tree 2 files changed +21
-1
lines changed Original file line number Diff line number Diff line change @@ -454,7 +454,10 @@ void close(){
454454 }
455455 }
456456 }
457-
457+
458+ public ServerAddress getServerAddress () {
459+ return _host ;
460+ }
458461
459462 Response _curResult ;
460463 Iterator <DBObject > _cur ;
Original file line number Diff line number Diff line change @@ -645,6 +645,20 @@ public DBCollection getCollection(){
645645 return _collection ;
646646 }
647647
648+ /**
649+ * Gets the Server Address of the server that data is pulled from.
650+ * Note that this information is not available if no data has been retrieved yet.
651+ * Availability is specific to underlying implementation and may vary.
652+ * @return
653+ */
654+ public ServerAddress getServerAddress () {
655+ if (_it != null ) {
656+ if (_it instanceof DBApiLayer .Result )
657+ return ((DBApiLayer .Result )_it ).getServerAddress ();
658+ }
659+ return null ;
660+ }
661+
648662 @ Override
649663 public String toString () {
650664 StringBuilder sb = new StringBuilder ();
@@ -658,6 +672,9 @@ public String toString() {
658672 sb .append (", limit=" ).append (_numWanted );
659673 if (_skip > 0 )
660674 sb .append (", skip=" ).append (_skip );
675+ ServerAddress addr = getServerAddress ();
676+ if (addr != null )
677+ sb .append (", addr=" ).append (addr );
661678 return sb .toString ();
662679 }
663680
You can’t perform that action at this time.
0 commit comments