[JAVA-1502] BSONObject et al.: wrong return value in JavaDoc for put(k,v) Created: 16/Oct/14  Updated: 30/Jan/15  Resolved: 27/Oct/14

Status: Closed
Project: Java Driver
Component/s: Documentation
Affects Version/s: 2.12.3
Fix Version/s: 2.13.0, 3.0.0

Type: Improvement Priority: Minor - P4
Reporter: Jens Grivolla Assignee: Jeffrey Yemin
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 Description   

BSONObject, BasicBSONObject, etc. claim to return the value passed to it, but they appear to rely on java.util.HashMap which returns the previous value: http://docs.oracle.com/javase/7/docs/api/java/util/HashMap.html#put(K,%20V)

example of JavaDoc of BSONObject, BasicBSONObject, ...:
{{
@return <tt>v</tt>
@return the <code>val</code> parameter
}}

P.s.: I was actually hoping it would return the BSONObject itself so I could chain put() operations together



 Comments   
Comment by Githook User [ 30/Jan/15 ]

Author:

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

Message: Fixed documentation of return value for BSONObject.put to indicate that it returns the previous value associated with the given key.

JAVA-1502
Branch: master
https://github.com/mongodb/mongo-java-driver/commit/af69a7948160482469babaee56e484a5c5e7e462

Comment by Githook User [ 27/Oct/14 ]

Author:

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

Message: Fixed documentation of return value for BSONObject.put to indicate that it returns the previous value associated with the given key.

JAVA-1502
Branch: 3.0.x
https://github.com/mongodb/mongo-java-driver/commit/af69a7948160482469babaee56e484a5c5e7e462

Comment by Githook User [ 27/Oct/14 ]

Author:

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

Message: Fixed documentation of return value for BSONObject.put to indicate that it returns the previous value associated with the given key.
Also fixed some Javadoc in BSONObject implementations.

JAVA-1502
Branch: master
https://github.com/mongodb/mongo-java-driver/commit/2c0c54226ca33afe0add3be23abc14c643e4fe6d

Comment by Jeffrey Yemin [ 16/Oct/14 ]

Yep, this is plain wrong. Thanks for catching it.

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