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 40401 Node.js counter page #3313

Merged
merged 19 commits into from
Jul 18, 2024

Conversation

osharaf-mdb
Copy link
Contributor

@osharaf-mdb osharaf-mdb commented Jun 24, 2024

Pull Request Info

Jira ticket: https://jira.mongodb.org/browse/DOCSP-40401

Note to Reviewer

Still fixing formatting, and currently only have code examples in typescript (javascript soon to come)
Creating a new JIRA ticket for pages that require an update as a result of this addition

Reminder Checklist

Before merging your PR, make sure to check a few things.

  • Did you tag pages appropriately?
    • genre
    • programming_language
    • meta.keywords
    • meta.description
  • Describe your PR's changes in the Release Notes section
  • Create a Jira ticket for related docs-realm work, if any

Release Notes

  • Counters - Node.js SDK
    • Node.js SDK > Model Data > Data Types > Counters: The Counters page was created to document the addition of the Counter class and data type to the Node.js SDK and updated the Table of Contents to reflect the addition.

Review Guidelines

REVIEWING.md

Copy link

netlify bot commented Jun 24, 2024

Deploy Preview for device-sdk ready!

Name Link
🔨 Latest commit de6920b
🔍 Latest deploy log https://app.netlify.com/sites/device-sdk/deploys/66995ec562dc4f0008d1534d
😎 Deploy Preview https://deploy-preview-3313--device-sdk.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

github-actions bot commented Jun 24, 2024

Readability for Commit Hash: de6920b

You can see any previous Readability scores (if they exist) by looking
at the comment's history.

Readability scores for changed documents:

  • source/sdk/node/model-data/data-types: Grade Level: 32.9, Reading Ease: -108.05
  • source/sdk/node/model-data/define-a-realm-object-model: Grade Level: 8.8, Reading Ease: 57.27
  • source/sdk/node/model-data/data-types/counters: Grade Level: 8.2, Reading Ease: 58.79
  • source/sdk/node/model-data/data-types/field-types: Grade Level: 4.2, Reading Ease: 79.87

For Grade Level, aim for 8 or below.

For Reading Ease scores, aim for 60 or above:

Score Difficulty
90-100 Very Easy
80-89 Easy
70-79 Fairly Easy
60-69 Medium
50-59 Fairly Hard
30-49 Hard
0-29 Very Hard

For help improving readability, try Hemingway App.

Copy link
Collaborator

@cbullinger cbullinger left a comment

Choose a reason for hiding this comment

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

Fantastic work on this so far! Let's review the feedback together

examples/node/v12/__tests__/data-types.test.ts Outdated Show resolved Hide resolved
source/sdk/node/model-data/data-types/counters.txt Outdated Show resolved Hide resolved
source/sdk/node/model-data/data-types/counters.txt Outdated Show resolved Hide resolved
source/sdk/node/model-data/data-types/counters.txt Outdated Show resolved Hide resolved
source/sdk/node/model-data/data-types/counters.txt Outdated Show resolved Hide resolved
source/sdk/node/model-data/data-types/counters.txt Outdated Show resolved Hide resolved
examples/node/v12/__tests__/data-types.test.ts Outdated Show resolved Hide resolved
Copy link
Contributor

@elle-j elle-j left a comment

Choose a reason for hiding this comment

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

Very nice updates Omar! Great seeing your contributions already. Left you some feedback and suggestions 👍

examples/node/v12/__tests__/data-types.test.ts Outdated Show resolved Hide resolved
examples/node/v12/__tests__/data-types.test.ts Outdated Show resolved Hide resolved
examples/node/v12/__tests__/data-types.test.ts Outdated Show resolved Hide resolved
examples/node/v12/__tests__/data-types.test.ts Outdated Show resolved Hide resolved
examples/node/v12/__tests__/data-types.test.ts Outdated Show resolved Hide resolved
examples/node/v12/__tests__/data-types.test.ts Outdated Show resolved Hide resolved
source/sdk/node/model-data/data-types/counters.txt Outdated Show resolved Hide resolved
source/sdk/node/model-data/data-types/counters.txt Outdated Show resolved Hide resolved
Comment on lines 34 to 38
Counters cannot be used as:

- Mixed values
- Primary keys
- Elements in a collection
Copy link
Contributor

@elle-j elle-j Jun 25, 2024

Choose a reason for hiding this comment

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

Adding to the above suggestion:

To me the *cannot* store null values becomes somewhat ambiguous as null values can be stored (if they're declared nullable as you've written). Essentially, nullable counters can be null in the db, which would make myObject.myCounter return null (thus, to access the potential value if the counter is not null, it'd be myObject.myCounter?.value, requiring the ? on the realm object counter property).

source/sdk/node/model-data/data-types/counters.txt Outdated Show resolved Hide resolved
@osharaf-mdb osharaf-mdb changed the title Docsp 40401 Node.js counter page DOCSP 40401 Node.js counter page Jun 26, 2024
@dacharyc dacharyc added the Add to consolidation feature branch PR merged after cutting the consolidation feature branch, so cherry-pick to the feature branch. label Jul 9, 2024
Copy link
Collaborator

@cbullinger cbullinger left a comment

Choose a reason for hiding this comment

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

This is really close! Great job on the updates. A few things to address, and some suggestions to take or leave, and we should be good to go! 🚀

examples/node/v12/__tests__/data-types.test.js Outdated Show resolved Hide resolved
source/sdk/node/model-data/data-types/counters.txt Outdated Show resolved Hide resolved
source/sdk/node/model-data/data-types/counters.txt Outdated Show resolved Hide resolved
source/sdk/node/model-data/data-types/counters.txt Outdated Show resolved Hide resolved
- The underlying value of the ``count`` is now ``1``, though it should be ``2`` to reflect
both devices' increments.

The ``Counter`` class makes it possible to sync these updates so the ``counter`` converges to
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
The ``Counter`` class makes it possible to sync these updates so the ``counter`` converges to
The ``Counter`` class makes it possible to sync these updates so the value converges to

[nit] there's a lot of monospace formatting on the page. might be helpful to remove the ones that aren't really needed (esp if they're also the term counter)

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 changed this instance from counter to "value" to remove the monospace formatting and changed line 59ish to read "The property is initialized by using either:" instead of "The counter field is initialized by using either:"

source/sdk/node/model-data/data-types/counters.txt Outdated Show resolved Hide resolved
source/sdk/node/model-data/data-types/field-types.txt Outdated Show resolved Hide resolved
source/sdk/node/model-data/data-types/counters.txt Outdated Show resolved Hide resolved
---------------------------

To initialize a counter, create your object using the ``realm.create()`` method. Pass in your
desired :ref:`Realm Object Schema <node-define-a-realm-object-schema>` and initial counter
Copy link
Collaborator

Choose a reason for hiding this comment

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

is it "the desired schema"? or the schema that contains the counter property?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Heard -- I ended up just dropping the word "desired" from that sentence.

@osharaf-mdb osharaf-mdb merged commit 1e41ff2 into mongodb:master Jul 18, 2024
11 checks passed
@osharaf-mdb osharaf-mdb deleted the DOCSP-40401-js-counter branch July 18, 2024 18:32
@docs-builder-bot
Copy link

docs-builder-bot commented Jul 18, 2024

@dacharyc dacharyc removed the Add to consolidation feature branch PR merged after cutting the consolidation feature branch, so cherry-pick to the feature branch. label Jul 19, 2024
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.

5 participants