[JAVA-986] toString of MongoClientOptions is inadequate Created: 02/Oct/13  Updated: 03/Apr/14  Resolved: 15/Nov/13

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

Type: Improvement Priority: Major - P3
Reporter: Bob Kuhar Assignee: Unassigned
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 Description   

The toString of a MongoClient does a really good job of documenting the Options that it was created with like

Mongo{authority=MongoAuthority{type=Set, serverAddresses=[bobk-mbp.local/10.78.4.164:27017, bobk-mbp.local/10.78.4.164:27018], credentials={credentials={}}}, options=MongoOptions{description='null', connectionsPerHost=10, threadsAllowedToBlockForConnectionMultiplier=5, maxWaitTime=2000, connectTimeout=2000, socketTimeout=2000, socketKeepAlive=false, autoConnectRetry=false, maxAutoConnectRetryTime=0, slaveOk=false, readPreference=primary, dbDecoderFactory=DefaultDBDecoder.DefaultFactory, dbEncoderFactory=DefaultDBEncoder.DefaultFactory, safe=false, w=0, wtimeout=0, fsync=false, j=false, socketFactory=javax.net.DefaultSocketFactory@446d0fff, cursorFinalizerEnabled=true, writeConcern=WriteConcern

{ "getlasterror" : 1}

/ (Continue Inserting on Errors? false), alwaysUseMBeans=false}}

The MongoClientOptions object fails to do the same job making my logging unable to pro-actively log the options I am about to open a Mongo connection with:

com.mongodb.MongoClientOptions@af9cc855

I would really like to see the toString of MongoClientOptions produce a toString identical to what the MongoClient's toString produces as options=MongoOptions.



 Comments   
Comment by Jeffrey Yemin [ 27/Feb/14 ]

Hi Bob,

Would you mind testing the fix for this issue in 2.12.0-rc0, available either on github or Maven Central?

Thanks,
Jeff

Comment by Githook User [ 15/Nov/13 ]

Author:

{u'username': u'jyemin', u'name': u'Jeff Yemin', u'email': u'jeff.yemin@10gen.com'}

Message: JAVA-986: Added MongoClientOptions.toString()
Branch: master
https://github.com/mongodb/mongo-java-driver/commit/406014b3e2099ad33e3d11c342b416e2b3413297

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