[JAVA-4051] BasicDBObject.equals throws exception when one of its fields is a UUID Created: 16/Mar/21 Updated: 28/Oct/23 Resolved: 19/Mar/21 |
|
| Status: | Closed |
| Project: | Java Driver |
| Component/s: | BSON |
| Affects Version/s: | None |
| Fix Version/s: | 4.2.3 |
| Type: | Bug | Priority: | Major - P3 |
| Reporter: | Jeffrey Yemin | Assignee: | Jeffrey Yemin |
| Resolution: | Fixed | Votes: | 2 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||
| Description |
|
Consider this code:
In the 3.x driver equal will be true, but in 4.x it will throw:
This is a breaking change. I think we can get around it though, because in the case of equality we don't really care what uuid representation is used, since we are only using its encoded form to test equality and then throw it away. Known workarounds:
Both are pretty invasive changes, though. This issue was originally reported in the Community Forums at https://developer.mongodb.com/community/forums/t/issue-with-uuid-after-upgrading-to-4-2-1-for-java-client/98519. |
| Comments |
| Comment by Githook User [ 19/Mar/21 ] |
|
Author: {'name': 'Jeff Yemin', 'email': 'jeff.yemin@mongodb.com', 'username': 'jyemin'}Message: Ensure BasicDBObject equals/hashCode works with UUID values (#688)
|
| Comment by Githook User [ 19/Mar/21 ] |
|
Author: {'name': 'Jeff Yemin', 'email': 'jeff.yemin@mongodb.com', 'username': 'jyemin'}Message: Ensure BasicDBObject equals/hashCode works with UUID values (#688)
|