Skip to content

Commit 5683525

Browse files
committed
Added IdGenerator to the POJOs docs.
JAVA-2674
1 parent 3321d3c commit 5683525

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

docs/reference/content/bson/pojos.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ A `ClassModel` for a POJO includes:
2424
* An optional discriminator value. The discriminator is the value used to represent the POJO class being stored.
2525
* An optional discriminator key. The document key name for the discriminator.
2626
* The use discriminator flag. This determines if the discriminator should be serialized. By default it is off.
27+
* An optional IdGenerator used to generate the `id` value, when inserting the POJO. (New in 3.10)
2728

2829
Each `PropertyModel` includes:
2930

@@ -318,10 +319,12 @@ The following Conventions are available from the [`Conventions`]({{<apiref "org/
318319
the PropertyModels. If the `idProperty` isn't set and there is a property named `_id` or `id` then it will be marked as the `idProperty`.
319320
* The [`SET_PRIVATE_FIELDS_CONVENTION`]({{<apiref "org/bson/codecs/pojo/Conventions.html#SET_PRIVATE_FIELDS_CONVENTION">}}). Enables
320321
private fields to be set directly using reflection, without the need of a setter method. Note this convention is not enabled by default.
321-
* The [`USE_GETTERS_FOR_SETTERS`]({{<apiref "org/bson/codecs/pojo/Conventions.html#USE_GETTERS_FOR_SETTERS">}}). Allows getters to be used
322+
* The [`USE_GETTERS_FOR_SETTERS`]({{<apiref "org/bson/codecs/pojo/Conventions.html#USE_GETTERS_FOR_SETTERS">}}) convention. Allows getters to be used
322323
for Map and Collection properties without setters, the collection/map is then mutated. Note this convention is not enabled by default.
324+
* The [`OBJECT_ID_GENERATORS`]({{<apiref "org/bson/codecs/pojo/Conventions.html#OBJECT_ID_GENERATORS">}}) convention. Adds an `IdGenerator` that
325+
generates new `ObjectId` for ClassModels that have an `ObjectId` value for the `id` property.
323326
* The [`DEFAULT_CONVENTIONS`]({{<apiref "org/bson/codecs/pojo/Conventions.html#DEFAULT_CONVENTIONS">}}), a list containing the
324-
`ANNOTATION_CONVENTION` and the `CLASS_AND_PROPERTY_CONVENTION`.
327+
`ANNOTATION_CONVENTION`, the `CLASS_AND_PROPERTY_CONVENTION` and the `OBJECT_ID_GENERATORS` convention.
325328
* The [`NO_CONVENTIONS`]({{<apiref "org/bson/codecs/pojo/Conventions.html#NO_CONVENTIONS">}}) an empty list.
326329

327330
Custom Conventions can either be set globally via the

0 commit comments

Comments
 (0)