diff --git a/docs/src/main/asciidoc/mongodb-panache.adoc b/docs/src/main/asciidoc/mongodb-panache.adoc index bef7cf9c635562..853f6e27b7dfa4 100644 --- a/docs/src/main/asciidoc/mongodb-panache.adoc +++ b/docs/src/main/asciidoc/mongodb-panache.adoc @@ -707,7 +707,7 @@ TIP: Using `@BsonProperty` is not needed to define custom column mappings, as th TIP: You can have your projection class extends from another class. In this case, the parent class also needs to have use `@ProjectionFor` annotation. -TIP: If you run Java 17+, records are a good fit for projection classes. +TIP: Records are a good fit for projection classes. == Query debugging @@ -724,6 +724,7 @@ quarkus.log.category."io.quarkus.mongodb.panache.common.runtime".level=DEBUG MongoDB with Panache uses the link:{mongodb-doc-root-url}/fundamentals/data-formats/document-data-format-pojo/[PojoCodecProvider], with link:{mongodb-doc-root-url}/fundamentals/data-formats/document-data-format-pojo/#configure-the-driver-for-pojos[automatic POJO support], to automatically convert your object to a BSON document. +This codec also supports Java records so you can use them for your entities or an attribute of your entities. In case you encounter the `org.bson.codecs.configuration.CodecConfigurationException` exception, it means the codec is not able to automatically convert your object. diff --git a/docs/src/main/asciidoc/mongodb.adoc b/docs/src/main/asciidoc/mongodb.adoc index 59d936c5544c0e..3885605ace972f 100644 --- a/docs/src/main/asciidoc/mongodb.adoc +++ b/docs/src/main/asciidoc/mongodb.adoc @@ -570,7 +570,8 @@ public class CodecFruitService { == The POJO Codec The link:https://www.mongodb.com/docs/drivers/java/sync/current/fundamentals/data-formats/document-data-format-pojo/[POJO Codec] provides a set of annotations that enable the customization of -the way a POJO is mapped to a MongoDB collection and this codec is initialized automatically by Quarkus +the way a POJO is mapped to a MongoDB collection and this codec is initialized automatically by Quarkus. +This codec also supports Java records so you can use them for your POJOs or an attribute of your POJOs. One of these annotations is the `@BsonDiscriminator` annotation that allows to storage multiple Java types in a single MongoDB collection by adding a discriminator field inside the document. It can be useful when working with abstract types or interfaces. diff --git a/extensions/panache/mongodb-panache/runtime/src/main/java/io/quarkus/mongodb/panache/package-info.java b/extensions/panache/mongodb-panache/runtime/src/main/java/io/quarkus/mongodb/panache/package-info.java index 0340f0bbc54c62..c4c79ebd505b75 100644 --- a/extensions/panache/mongodb-panache/runtime/src/main/java/io/quarkus/mongodb/panache/package-info.java +++ b/extensions/panache/mongodb-panache/runtime/src/main/java/io/quarkus/mongodb/panache/package-info.java @@ -56,8 +56,9 @@ * otherwise it will be the name of your entity. *

*

- * The Mongo PojoCodec is used to serialize your entity to Bson Document, you can find more information on it's - * documentation page: https://mongodb.github.io/mongo-java-driver/3.10/bson/pojos/ + * The Mongo PojoCodec is used to serialize your entity to a Bson Document, you can find more information on its + * documentation page: https://www.mongodb.com/docs/drivers/java/sync/current/fundamentals/data-formats/document-data-format-pojo. + * This codec also supports Java records. * You can use the MongoDB annotations to control the mapping to the database : @BsonId, * @BsonProperty("fieldName"), @BsonIgnore. *