Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Explain in MongoDB docs that records are supported #44322

Merged
merged 1 commit into from
Nov 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion docs/src/main/asciidoc/mongodb-panache.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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.
Expand Down
3 changes: 2 additions & 1 deletion docs/src/main/asciidoc/mongodb.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,10 @@
* otherwise it will be the name of your entity.
* </p>
* <p>
* 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 : <code>@BsonId</code>,
* <code>@BsonProperty("fieldName")</code>, <code>@BsonIgnore</code>.
* </p>
Expand Down
Loading