Skip to content

Commit 8e92160

Browse files
committed
Explain in MongoDB docs that records are supported
Fixes quarkusio#38086
1 parent 91cc2dd commit 8e92160

File tree

3 files changed

+8
-4
lines changed

3 files changed

+8
-4
lines changed

docs/src/main/asciidoc/mongodb-panache.adoc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -707,7 +707,7 @@ TIP: Using `@BsonProperty` is not needed to define custom column mappings, as th
707707

708708
TIP: You can have your projection class extends from another class. In this case, the parent class also needs to have use `@ProjectionFor` annotation.
709709

710-
TIP: If you run Java 17+, records are a good fit for projection classes.
710+
TIP: Records are a good fit for projection classes.
711711

712712
== Query debugging
713713

@@ -724,6 +724,7 @@ quarkus.log.category."io.quarkus.mongodb.panache.common.runtime".level=DEBUG
724724

725725
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],
726726
to automatically convert your object to a BSON document.
727+
This codec also supports Java records so you can use them for your entities or an attribute of your entities.
727728

728729
In case you encounter the `org.bson.codecs.configuration.CodecConfigurationException` exception, it means the codec is not able to
729730
automatically convert your object.

docs/src/main/asciidoc/mongodb.adoc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -570,7 +570,8 @@ public class CodecFruitService {
570570
== The POJO Codec
571571

572572
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
573-
the way a POJO is mapped to a MongoDB collection and this codec is initialized automatically by Quarkus
573+
the way a POJO is mapped to a MongoDB collection and this codec is initialized automatically by Quarkus.
574+
This codec also supports Java records so you can use them for your POJOs or an attribute of your POJOs.
574575

575576
One of these annotations is the `@BsonDiscriminator` annotation that allows to storage multiple Java types in a single MongoDB collection by adding
576577
a discriminator field inside the document. It can be useful when working with abstract types or interfaces.

extensions/panache/mongodb-panache/runtime/src/main/java/io/quarkus/mongodb/panache/package-info.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,10 @@
5656
* otherwise it will be the name of your entity.
5757
* </p>
5858
* <p>
59-
* The Mongo PojoCodec is used to serialize your entity to Bson Document, you can find more information on it's
60-
* documentation page: https://mongodb.github.io/mongo-java-driver/3.10/bson/pojos/
59+
* The Mongo PojoCodec is used to serialize your entity to a Bson Document, you can find more information on its
60+
* documentation page:
61+
* https://www.mongodb.com/docs/drivers/java/sync/current/fundamentals/data-formats/document-data-format-pojo.
62+
* This codec also supports Java records.
6163
* You can use the MongoDB annotations to control the mapping to the database : <code>@BsonId</code>,
6264
* <code>@BsonProperty("fieldName")</code>, <code>@BsonIgnore</code>.
6365
* </p>

0 commit comments

Comments
 (0)