[JAVA-1617] DBCollection should not return null WriteResult on an unacknowledged write Created: 09/Jan/15  Updated: 31/Mar/15  Resolved: 10/Jan/15

Status: Closed
Project: Java Driver
Component/s: API, Write Operations
Affects Version/s: 3.0.0
Fix Version/s: 3.0.0

Type: Bug Priority: Major - P3
Reporter: Jeffrey Yemin Assignee: Jeffrey Yemin
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 Description   

In 2.x, an unacknowledged write operation on DBCollection returns a WriteResult, and any access to the WriteResult properties will trigger a call to the getlasterror command on the same socket, which is likely to fail with an exception.

In 3.x we will no longer call getlasterror, and instead DBCollection returns a null WriteResult for any unacknowledged writes. This ticket proposes to change DBCollection to be closer to 2.x: return a WriteResult, but throw an exception from all property accessors.



 Comments   
Comment by Jeffrey Yemin [ 31/Mar/15 ]

Closing all resolved 3.0.0 issues, as 3.0.0 has been tagged and released.

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: For an unacknowledged write, DBCollection now returns, instead of null, a WriteResult that is configured to throw exceptions for all property accessors.
This is closer to the behavior of 2.x, which also returns an instance, but only sometimes will throw exceptions from property accessors (based on whether
any other threads have used the socket in the mean time).

JAVA-1617
Branch: master
https://github.com/mongodb/mongo-java-driver/commit/f664faa3627fa12fc3838b9fb0c9c29d39d01bef

Comment by Githook User [ 10/Jan/15 ]

Author:

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

Message: For an unacknowledged write, DBCollection now returns, instead of null, a WriteResult that is configured to throw exceptions for all property accessors.
This is closer to the behavior of 2.x, which also returns an instance, but only sometimes will throw exceptions from property accessors (based on whether
any other threads have used the socket in the mean time).

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

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