[JAVA-2767] bson: fails decoding when id property is named id instead of _id Created: 01/Feb/18 Updated: 27/Oct/23 Resolved: 02/Feb/18 |
|
| Status: | Closed |
| Project: | Java Driver |
| Component/s: | POJO |
| Affects Version/s: | 3.6.1 |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Major - P3 |
| Reporter: | Juan F. Codagnone | Assignee: | Ross Lawley |
| Resolution: | Works as Designed | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||
| Description |
|
Hi, I'm trying to decode a BSON written by other system using the BSON library and I'm unable to decode correctly. I'm just reading values from mongodb (this app read-only, data stored is legacy). The bson has an id property (instead of the classical _id) embeded inside other object, and its never set the java property. The first patch show the decoding issue for a simpler doc:
You might say that the field should be named like _id, and I might agree.
My real-life case happens when decoding an embed object (that I might argue that in doesn't need to follow the _id convention):
I don't have a proposed solution, just the report. Regards, |
| Comments |
| Comment by Ross Lawley [ 02/Feb/18 ] |
|
Added |
| Comment by Juan F. Codagnone [ 02/Feb/18 ] |
|
The work around of |
| Comment by Juan F. Codagnone [ 01/Feb/18 ] |
|
I'm sorry for the duplicate. Will try the workaround: https://jira.mongodb.org/browse/JAVA-2750?focusedCommentId=1784548&page=com.atlassian.jira.plugin.system.issuetabpanels%3Acomment-tabpanel#comment-1784548 |
| Comment by Jeffrey Yemin [ 01/Feb/18 ] |
|
This may be a duplicate of |