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

DOCSP-32078: data class note #132

Merged
merged 14 commits into from
Oct 2, 2023
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ You can use the following annotations on data classes:
.. list-table::
:header-rows: 1
:stub-columns: 1
:widths: 10 10
:widths: 30 70

* - Annotation Name
- Description
Expand All @@ -114,6 +114,13 @@ You can use the following annotations on data classes:
* - ``BsonRepresentation``
- Specifies the BSON type used to store the value when different from the
data class property.

.. note::

Use this annotation only on a property you are
storing as a different BSON type. You might experience errors
if you include the ``BsonRepresentation`` annotation on a
property you are storing as the same type.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggestion:

I think the current description ("Specifies the BSON type...") could be modified to communicate what's in this callout which would make the content of this description less repetitive.

"Specifies the BSON type MongoDB uses to store the value. Use this annotation only when you need to store the value as a BSON type that differs from the data class property."

And perhaps the callout could be a warning if necessary:

"Your code may throw exceptions If you specify the same type as the data class."


For reference information on these property annotations,
refer to the `org.bson.codecs.pojo.annotations <{+api+}/apidocs/bson/org/bson/codecs/pojo/annotations/package-summary.html>`__
Expand Down
Loading