[JAVA-2768] Add annotation to exclude id field from being marked as the IdProperty. Created: 02/Feb/18  Updated: 28/Oct/23  Resolved: 06/Feb/18

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

Type: Improvement Priority: Major - P3
Reporter: Ross Lawley Assignee: Ross Lawley
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
is related to JAVA-2750 Pojo codec conversion missing id field Closed

 Description   

Some users may have two "id" fields - the automatic "_id" and their own.
Also, when a POJO is embedded it makes less sense to convert "id" fields to "_id".



 Comments   
Comment by Ross Lawley [ 06/Feb/18 ]

In the 3.7.0 release the @BsonProperty annotation can be used to ensure that a id property is not automatically converted automatically to _id.

Comment by Githook User [ 06/Feb/18 ]

Author:

{'email': 'ross.lawley@gmail.com', 'name': 'Ross Lawley', 'username': 'rozza'}

Message: Fixed the BsonProperty annotation interaction for idProperty

Allows users to use the default conventions and turn off automatic
`id` -> `_id` mapping.

JAVA-2768
Branch: master
https://github.com/mongodb/mongo-java-driver/commit/7d80ace851b82058e121bba5b89513094c1b9696

Comment by Ross Lawley [ 02/Feb/18 ]

PR: https://github.com/rozza/mongo-java-driver/pull/247

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