Skip to content

Conversation

jordan-smith721
Copy link
Contributor

@jordan-smith721 jordan-smith721 commented Nov 19, 2024

Pull Request Info

PR Reviewing Guidelines

JIRA - https://jira.mongodb.org/browse/DOCSP-44794
Staging - https://deploy-preview-69--docs-mongoid.netlify.app/data-modeling/field-types/

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?

Copy link

netlify bot commented Nov 19, 2024

Deploy Preview for docs-mongoid ready!

Name Link
🔨 Latest commit 793c747
🔍 Latest deploy log https://app.netlify.com/sites/docs-mongoid/deploys/674e19ddc8f4ff00089f34cc
😎 Deploy Preview https://deploy-preview-69--docs-mongoid.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.

@jordan-smith721 jordan-smith721 marked this pull request as ready for review November 19, 2024 17:26
@rustagir rustagir self-requested a review November 19, 2024 17:50
Copy link
Contributor

@rustagir rustagir left a comment

Choose a reason for hiding this comment

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

good work adapting this hefty page! lmk if you have qs

.. toctree::
:caption: Data Modeling

Field Types </data-modeling/field-types>
Copy link
Contributor

Choose a reason for hiding this comment

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

S: pull in upstream standardized branch to avoid making this fix again

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'll do a manual merge after everything else is good to go

Comment on lines 23 to 24
In this guide, you can learn about the field types that you can use in
{+odm+} to define the schema for your MongoDB documents.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
In this guide, you can learn about the field types that you can use in
{+odm+} to define the schema for your MongoDB documents.
In this guide, you can learn about the field types supported in
{+odm+} that you can use to define the schema for your MongoDB documents.

Comment on lines 26 to 27
MongoDB uses :manual:`BSON types </reference/bson-types/>` to represent the type of
data stored in document fields. To use that data in a {+odm+} application,
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
MongoDB uses :manual:`BSON types </reference/bson-types/>` to represent the type of
data stored in document fields. To use that data in a {+odm+} application,
MongoDB uses :manual:`BSON types </reference/bson-types/>` to represent the data
types stored in document fields. To use BSON data in a {+odm+} application,

Comment on lines 28 to 30
{+odm+} must convert the BSON types to {+language+} types at runtime. For example,
when retrieving a document from the database, {+odm+} translates a BSON field
with the type ``double`` to use the {+language+} ``Float`` type. It then translates that
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
{+odm+} must convert the BSON types to {+language+} types at runtime. For example,
when retrieving a document from the database, {+odm+} translates a BSON field
with the type ``double`` to use the {+language+} ``Float`` type. It then translates that
{+odm+} must convert the BSON types to {+language+} types at runtime. For example,
when retrieving a document from the database, {+odm+} translates a BSON
``double`` type to the {+language+} ``Float`` type. When you save the document again,

{+odm+} must convert the BSON types to {+language+} types at runtime. For example,
when retrieving a document from the database, {+odm+} translates a BSON field
with the type ``double`` to use the {+language+} ``Float`` type. It then translates that
field back to a BSON ``double`` when saving the document to the database.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
field back to a BSON ``double`` when saving the document to the database.
{+odm+} converts the field back to a BSON ``double``.


Because updating and replacing fields containing these reserved characters
requires special operators, calling getters and setters on these fields
raises an ``InvalidDotDollarAssignment`` exception.
Copy link
Contributor

Choose a reason for hiding this comment

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

S: add additional information section to link to other relevant guides (can leave as a todo)

# end-define-fields

# start-define-untyped
class Person
Copy link
Contributor

Choose a reason for hiding this comment

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

S: consider changing to Product to match other class in the section

Comment on lines 53 to 57
def set_vals
self.first_name = 'Daniel'
self.url = {'home_page' => 'http://www.homepage.com'}
save
end
Copy link
Contributor

Choose a reason for hiding this comment

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

Q: why does this example use this class method instead of using regular methods to create an instance?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Looks like in the original it was made like that to compare with an example that won't work. Updated to use regular methods like the other examples.

profile.color
# Outputs: "white"

# Writes 0 to the database
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
# Writes 0 to the database
# Sets "color" field to 0 in the database

Copy link
Contributor

@rustagir rustagir left a comment

Choose a reason for hiding this comment

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

left a few last comments to make some small fixes but overall great job responding to the feedback!


- If set to ``true``, {+odm+} stores ``BigDecimal`` values as BSON ``Decimal128``
values.
- If set to ``false`` (default), {+odm+} stores ``BigDecimal`` values as a string.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
- If set to ``false`` (default), {+odm+} stores ``BigDecimal`` values as a string.
- If set to ``false`` (default), {+odm+} stores ``BigDecimal`` values as strings.

``Decimal128`` has a maximum value of approximately ``10^6145`` and a minimum
of approximately ``-10^6145``, with a maximum of 34 bits of precision. If you
are storing values that are outside of these limits, we recommend storing them
as a string instead.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
as a string instead.
as strings instead.

Comment on lines 348 to 349
You can avoid this issue by specifying the field as a ``BigDecimal`` type,
rather than untyped.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
You can avoid this issue by specifying the field as a ``BigDecimal`` type,
rather than untyped.
You can avoid this issue by specifying the field as a ``BigDecimal`` type,
instead of as untyped.

application. Values that cannot be directly converted to symbols, such as
integers and arrays, are converted into strings and then into symbols.

The following example stores a ``status`` field as a ``StringifiedSymbol`` and
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
The following example stores a ``status`` field as a ``StringifiedSymbol`` and
The following example defines the ``status`` field as a ``StringifiedSymbol`` and

-----------------------------------------

You can use strings or symbols to specify certain field types in {+odm+}, instead of
using their class names. The following example specifies the ``state`` field by
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
using their class names. The following example specifies the ``state`` field by
using their class names. The following example specifies the ``order_num`` field by

deserializes them. To create a custom field type, define a class that
implements the following methods:

- ``mongoize``, which takes an instance of your custom type and converts it to
Copy link
Contributor

Choose a reason for hiding this comment

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

It doesnt look like you added the parentheses

deserializes them. To create a custom field type, define a class that
implements the following methods:

- ``mongoize``, which takes an instance of your custom type and converts it to
Copy link
Contributor

Choose a reason for hiding this comment

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

S: consider changing the format of this list to match whats done in other sections

Suggested change
- ``mongoize``, which takes an instance of your custom type and converts it to
- ``mongoize``: Takes an instance of your custom type and converts it to

# end-timestamps-disable

# start-timestamps-short
class Band
Copy link
Contributor

Choose a reason for hiding this comment

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

S: consider using the Post class for consistency with the prev examples in this section

profile.color
# Outputs: "white"

# Sets "color" field to 0 in
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
# Sets "color" field to 0 in
# Sets "color" field to 0 in MongoDB

@jordan-smith721 jordan-smith721 merged commit 469d562 into mongodb:standardized Dec 2, 2024
3 of 5 checks passed
@jordan-smith721 jordan-smith721 deleted the DOCSP-44794-field-types branch December 2, 2024 20:35
rustagir added a commit that referenced this pull request Jan 28, 2025
* DOCSP-42732: qs

* fix

* wip

* remove action

* NR suggestion

* DOCSP-42732: qs download

* wip

* adapt for sinatra

* vale fix

* snooty landing page

* MW PR fixes 1

* DOCSP-42733: atlas prep qs

* MW PR fixes 1

* DOCSP-42735: configure cxn

* small fix - vale

* JS PR fixes 1

* DOCSP-44008: read/write sinatra quickstart

* fixes

* NR PR fixes 1

* DOCSP-43961: rails qs

* vale

* ordering

* small fix

* MW PR fixes 1

* small fixes

* MW PR fixes 2

* DOCSP-44647: add to existing app

* fix vale action

* vale fixes

* depth

* MW PR fixes 1

* fixes

* DOCSP-42745: interact with data drawer

* tags

* fix vale action

* remove extra word

Co-authored-by: Nora Reidy <nora.reidy@mongodb.com>

* DOCSP-42753: specify query part 1

* vale

* title

* code edits

* MW PR fixes 2

* DOCSP-44849: modify results

* vale

* JS PR fixes 1

* fix

* fix

* list fixes

* MW PR fixes 1

* DOCSP-44954: scoping

* add landing page

* link

* vale

* highlighting

* DOCSP-44821: specify a query pt 2

* MR PR fixes 1

* wip

* wip

* wip

* small fixes

* DOCSP-42767 Aggregation (#57)

* DOCSP-42774: transactions

* vale

* link text

* MW PR fixes 1

* MR PR fixes 1

* DOCSP-45306: model data drawer

* DOCSP-45330: inheritance (WIP)

* MR PR fixes 2

* try using roles

* wip

* vale

* add label

* fixes

* fix

* small fixes - MW

* DOCSP-45358: documents

* fix

* wip

* wip

* DR tech review 1

* page fmt

* page fmt

* SA PR fixes 1

* MR PR fixes 1

* DR small fix

Co-authored-by: Dmitry Rybakov <160598371+comandeo-mongo@users.noreply.github.com>

* DOCSP-45360: nested attributes (#71)

* DOCSP-45360: nested attributes

* vale + fixes

* fixes

* NR PR fixes 1

* DOCSP-45362: text search (#72)

* DOCSP-45362: text search

* wip

* vale

* MM PR fixes 1

* DOCSP-45436 Field Behaviors page (#68)

* DOCSP-45363: validation (#73)

* DOCSP-45363: validation

* keywords

* wip

* SA PR fixes 1

* DOCSP-44794 Field Types (#69)

* DOCSP-45357 Sharding Configuration (#76)

* DOCSP-42762: Indexes (#74)

* DOCSP-45367 Associations pt. 1 (#79)

* DOCSP-45368: Persistence Configuration (#77)

* DOCSP-45361: callbacks (#75)

* DOCSP-45361: callbacks

* wip

* wip

* wip

* NR PR fixes 1

* DOCSP-45364: CRUD pt 1 (#81)

* checkpoint

* checkpoint 2

* woohoo first pass

* indent

* Edits

* updates

* vale chekcs

* RR PR fixes 1

* fix code file

* code fixes

* RM PR fixes 1

---------

Co-authored-by: rustagir <rea.rustagi@mongodb.com>

* DOCSP-45110: queries subsections (#80)

* DOCSP-45110: queries misc sections

* wip:

* vale

* MR PR fixes 1

* GM PR fixes 1

* DOCSP-46072 Associations part 2 (#82)

* DOCSP-46394: CRUD remaining sections (#83)

* DOCSP-46394: CRUD remaining sections

* vale fixes

* JS PR fixes 1

* DOCSP-46213: bump to rails 8 and remove old tuts (#84)

* DOCSP-45356: i&h + code doc (#86)

* DOCSP-45356: i&h + code doc

* remove contributing

* vale fixes

* link fix

* vale fixes + RM comment

* DOCSP-42770: release notes/whats new (#87)

* DOCSP-42770: release notes/whats new

* fixes

* fixes

* DOCSP-42773: api links (#88)

* DOCSP-42773: api links

* fix

* link fixes

* DOCSP-42772: compatibility (#90)

* DOCSP-42772: compatibility

* small fix

* small fix

* SA PR fixes 1

* delete files for old build system

* column width adjustment

* DOCSP-45366 Encryption (#89)

* DOCSP-42741: config pages (#91)

* DOCSP-42741: config

* wip

* wip

* some vale fixes

* RM PR fixes 1

* small fix

* DOCSP-46555: rails integration (#92)

* wip

* DOCSP-46555: rails integration

* RM PR fixes 1

* DOCSP-45359 External Resources (#94)

* add additional resources page

* edits

* feedback

* DOCSP-42743 Collection config (#95)

* DOCSP-42730: landing page (#96)

* DOCSP-42730: landing page

* MW PR fixes 1

* small fix

* small fix

* small fix

* DOCSP-46121: cleanup (#97)

* cleanup

* copy compat action

* redirects

* MW PR fixes 1

* add index section

* change vs in redirects

---------

Co-authored-by: Nora Reidy <nora.reidy@mongodb.com>
Co-authored-by: Jordan Smith <45415425+jordan-smith721@users.noreply.github.com>
Co-authored-by: Dmitry Rybakov <160598371+comandeo-mongo@users.noreply.github.com>
Co-authored-by: Maya Raman <maya.raman19@gmail.com>
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.

2 participants