Skip to content

DOCSP-42606: class maps feedback #592

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

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

rustagir
Copy link
Collaborator

@rustagir rustagir commented Apr 15, 2025

Pull Request Info

PR Reviewing Guidelines

JIRA - https://jira.mongodb.org/browse/DOCSP-42606

Staging Links

Self-Review Checklist

  • Is this free of any warnings or errors in the RST?
  • Did you run a spell-check?
  • Did you run a grammar-check?
  • Are all the links working?
  • Are the facets and meta keywords accurate?
  • Are the page titles greater than 20 characters long and SEO relevant?

Copy link

netlify bot commented Apr 15, 2025

Deploy Preview for docs-csharp ready!

Name Link
🔨 Latest commit 243c3c7
🔍 Latest deploy log https://app.netlify.com/sites/docs-csharp/deploys/67fea8aee0085600086dd5f9
😎 Deploy Preview https://deploy-preview-592--docs-csharp.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link
Collaborator

@rachel-mack rachel-mack left a comment

Choose a reason for hiding this comment

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

Some suggestions:

Comment on lines 101 to 102
level by using attributes with the class or by calling methods while registering
a class map.
Copy link
Collaborator

Choose a reason for hiding this comment

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

You didn't add this, but I think this should be changed?

Suggested change
level by using attributes with the class or by calling methods while registering
a class map.
level by using attributes within the class or by calling methods while registering
a class map.

Comment on lines 225 to 229
You can use GUIDs instead of ``ObjectId`` values to represent your
document IDs in MongoDB. By default, the driver uses the
``GuidGenerator`` type to generate a unique value for the ID property.
You must specify the GUID representation by initializing a
``GuidSerializer``.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Based on the description in the String IDs section, this seems like it goes against MongoDB best practices. Is there a reason we don't recommend this? Or is there a specific use case where we would recommend this?

Copy link
Collaborator Author

@rustagir rustagir Apr 15, 2025

Choose a reason for hiding this comment

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

I'll change the wording here to not suggest using GUIDs

Some people are migrating to MongoDB using legacy data, which might use UUIDs/GUIDs as the unique identifiers.


Even if you specify a value for the ``YearBuilt`` property, the field is
not saved in MongoDB.

Copy link
Collaborator

Choose a reason for hiding this comment

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

You could add a reciprocal note that links to instructions for omitting during mapping.

@rustagir rustagir requested review from a team, JamesKovacs and BorisDog and removed request for a team and JamesKovacs April 15, 2025 18:43
Omit Fields
~~~~~~~~~~~

By default, the driver serializes all fields in your POCOS, whether you
Copy link
Collaborator

Choose a reason for hiding this comment

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

POCOs?

~~~~~~~~~~~

By default, the driver serializes all fields in your POCOS, whether you
define them or not. You can prevent specified fields from being
Copy link
Collaborator

Choose a reason for hiding this comment

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

By "define" you probably mean map/automap?. As a field in POCO is it's definition, therefore always defined.
I'd just omit that part.


You cannot use the ``[BsonIgnoreIfNull]`` attribute or
``SetIgnoreIfNull()`` method to prevent undefined numerical
properties from being serialized unless you mark the properties as
Copy link
Collaborator

Choose a reason for hiding this comment

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

"undefined numerical property" wording might be confusing for .NET users, as numeric (value) values are always defined. 'Uninitialized' or 'default' sound better.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants