-
Notifications
You must be signed in to change notification settings - Fork 88
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-15613): Node.js collections type #1044
(DOCSP-15613): Node.js collections type #1044
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are a couple of places where I think the word choice could be improved, but otherwise LGTM!
- Live results collections always reflect the current results of the associated query. | ||
- Live lists always reflect the current state of the relationship on the {+realm+} instance. | ||
|
||
A collection is **not** live when: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is weirdly formatted on staging. I think you're missing an empty line after this line and it's all running together as a single paragraph.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see that now, fixed 👍
- Live lists always reflect the current state of the relationship on the {+realm+} instance. | ||
|
||
A collection is **not** live when: | ||
- the collection is enumerated using a :mdn:`for..in <Web/JavaScript/Reference/Statements/for...in>` or :mdn:`for..of <Web/JavaScript/Reference/Statements/for...of>` statement. ``for...in`` and ``for...of`` enumerate over the objects that matched the query when the enumeration is begun even if some of them are deleted or modified to be excluded by the filter during the enumeration. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: the grammar in this line is a bit odd. "enumerate over the objects" is present tense, "matched the query" is past tense, and "enumeration is begun" is present and a bit awkward. Maybe there's another way to say this? Maybe something like:
for...in
andfor...of
query for a match, and then begin enumerating over the matched objects. This enumeration reflects a snapshot of the data at the time of the query; it does not reflect objects that have been deleted or modified...
Actually, as I'm trying to improve this, I realize I'm a bit confused by what this means in the context of this line: "to be excluded by the filter during the enumeration." Maybe this whole bullet could be reworded?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's fair, I've altered it to be:
- it is a results collection that you are iterating through using a for in or for of statement. Both statements will continue to iterate through objects in the collection even if you have deleted or modified the collection's objects to exclude them from the filter that produced the results collection.
- the collection is a frozen :js-sdk:`Results.snapshot() <Realm.Collection.html#snapshot>` | ||
|
||
Combined with :ref:`collection notifications | ||
<node-change-notifications>`, live collections enable clean, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: "clean" code seems a bit like jargon. If you mean something specific by this, such as "easy to maintain" or "good separation of responsibilities" - perhaps we could use that specific phrase instead?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fair point, removed the word clean here - it's a bit redundant to "reactive"
As a result of lazy evaluation, you do not need any special | ||
mechanism to limit query results with {+client-database+}. For example, if | ||
your query matches thousands of objects, but you only want | ||
to load the first ten, simply access only the first ten |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: "simply access only" reads a bit weird. Maybe drop the "simply" or put in something like: "you can specifically access the first ten..." or "limit the results to the first ten..."
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fair point, removed "simply" 👍
Co-authored-by: Dachary <dc@dacharycarey.com>
…alm into Nodejs-collections-type
* New data types node rn (#1040) * new data types for node * added data types to TOC Co-authored-by: Mohammad Hunan Chughtai <mohammad.hunan@mongodb.com> * fixed refs for node.js data types * update doc * Remove accidental changes * added empty test file * (DOCSP-15613): Added Node.js field types (#1041) * Added node.js field types * fixed wording * fixed typo * fix typo in mdn urls * added additional data types * fix monospace err Co-authored-by: Mohammad Hunan Chughtai <mohammad.hunan@mongodb.com> * (DOCSP-15613): Node.js collections type (#1044) * Add content to Node.js > Data Types > Collections.txt * Removed unneeded spacing * clean up collections page + add headers * Filled out collections page * fix refs * fix typo * Update source/sdk/node/data-types/collections.txt * Update source/sdk/node/data-types/collections.txt * Update source/sdk/node/data-types/collections.txt Co-authored-by: Dachary <dc@dacharycarey.com> * fix rst * fix woridng * added ref * removed unneeded word * removed unneeded word * added period Co-authored-by: Mohammad Hunan Chughtai <mohammad.hunan@mongodb.com> Co-authored-by: Dachary <dc@dacharycarey.com> * (DOCSP-15613): Node.js embedded objects type (#1047) * Added documentation of Node.js embedded objects under data types * clean up relationships and embedded objects * added CRUD examples for embedded obj * added bluehawked examples * fix rst syntax highlight + add description for deletes * Update source/sdk/node/data-types/embedded-objects.txt * Update source/sdk/node/data-types/embedded-objects.txt * Update source/sdk/node/data-types/embedded-objects.txt * Update source/sdk/node/data-types/embedded-objects.txt * Update source/sdk/node/data-types/embedded-objects.txt Co-authored-by: Mohammad Hunan Chughtai <mohammad.hunan@mongodb.com> * Docsp 14569 mixed data type (#1064) * attempt to add bluehawked mixed example snippets * fixed wording * Update source/examples/generated/node/data-types.codeblock.query-objects-with-mixed-values.js * Update examples/node/Examples/data-types.js Co-authored-by: Mohammad Hunan Chughtai <mohammad.hunan@mongodb.com> * (DOCSP-14565): Dictionary data type (#1058) * (DOCSP-14565): Dictionary Data Type - Node.js * added unit tested + bluehawked dictionary examples * Update examples/node/package.json * removed unneeded file * Added new examples for dictionaries * update dictionary examples * fix capitalization * moved addlistener down * fix comment * update wording to be clearer on type usage in dict * fix wording * fix wording Co-authored-by: Mohammad Hunan Chughtai <mohammad.hunan@mongodb.com> * (DOCSP-14577): UUID (#1067) * bump realmjs to 10.5.0-beta-1 * removed uuid as it's own page and added a subsection on it * added uuid bluehawked snippet + readded uuid to toc * added uuid examples * removed uuid from field types as a paragraph * update wording * update wording * fix passive voice * add specific uuid example * removed innacurate collections are homogenous (per mixed) * (DOCSP-14573): set data type (#1079) * added set examples + bluehawked * literal included set exampkes * added delete one set item example * fix typo * added descriptions to set * fix grammar * changed link + hunter to generic names * added capitalization to clearly define Realm Set as a term * fix wording + formatting" * clarified wording * fix literalincldue indentation * fix typo * more wording fixes * clean up realm object model for set wording * fix character names for examples * clarified traversal order wording * rst typo in <set> * changed set to mySet * fix overview wording * updated overview to be more clear on differences between array * updated create wording * Update source/examples/generated/node/data-types.codeblock.remove-all-items-from-set.js Co-authored-by: Kenneth Geisshirt <k@zigzak.net> * Update source/examples/generated/node/data-types.codeblock.remove-specific-item-from-set.js Co-authored-by: Kenneth Geisshirt <k@zigzak.net> * Update source/sdk/node/data-types/sets.txt Co-authored-by: Kenneth Geisshirt <k@zigzak.net> * fix grammar + wording + changed Set to Realm.Set in js snippets * Fix woridng Co-authored-by: Kenneth Geisshirt <k@zigzak.net> * fill out field types * add react native data types as a copy of node data types * add data types to toc * fix rn mixed links * attempt to add realm-js links * more grammar and woridng fixes * wording fixes * Update source/sdk/node/data-types/uuid.txt Co-authored-by: nate contino <nathan.contino@mongodb.com> * change uuid note on rn to match node * added note about obj id to both rn and node * Update source/sdk/node/data-types/mixed.txt Co-authored-by: nate contino <nathan.contino@mongodb.com> * fix 'mixed' formatting on rn to match node * change monospace to bold * fix spacing errors * fix wording * correct supported types for mixed * wording update Co-authored-by: Mohammad Hunan Chughtai <mohammad.hunan@mongodb.com> Co-authored-by: Dachary <dc@dacharycarey.com> Co-authored-by: Kenneth Geisshirt <k@zigzak.net> Co-authored-by: nate contino <nathan.contino@mongodb.com>
<h3>Snyk has created this PR to upgrade @testing-library/react from 12.1.3 to 12.1.5.</h3> :information_source: Keep your dependencies up-to-date. This makes it easier to fix existing vulnerabilities and to more quickly identify and fix newly disclosed vulnerabilities when they affect your project. <hr/> - The recommended version is **2 versions** ahead of your current version. - The recommended version was released **a year ago**, on 2022-04-11. <details> <summary><b>Release notes</b></summary> <br/> <details> <summary>Package name: <b>@testing-library/react</b></summary> <ul> <li> <b>12.1.5</b> - <a href="https://snyk.io/redirect/github/testing-library/react-testing-library/releases/tag/v12.1.5">2022-04-11</a></br><h2><a href="https://snyk.io/redirect/github/testing-library/react-testing-library/compare/v12.1.4...v12.1.5">12.1.5</a> (2022-04-11)</h2> <h3>Bug Fixes</h3> <ul> <li>Only supports React < 18 (<a href="https://snyk.io/redirect/github/testing-library/react-testing-library/issues/1041" data-hovercard-type="pull_request" data-hovercard-url="/testing-library/react-testing-library/pull/1041/hovercard">#1041</a>) (<a href="https://snyk.io/redirect/github/testing-library/react-testing-library/commit/9e2b5dbb4632799ae38f1341cb79ef35d1bd6652">9e2b5db</a>)</li> </ul> </li> <li> <b>12.1.4</b> - <a href="https://snyk.io/redirect/github/testing-library/react-testing-library/releases/tag/v12.1.4">2022-03-09</a></br><h2><a href="https://snyk.io/redirect/github/testing-library/react-testing-library/compare/v12.1.3...v12.1.4">12.1.4</a> (2022-03-09)</h2> <h3>Bug Fixes</h3> <ul> <li>Match runtime type of baseElement in TypeScript types (<a href="https://snyk.io/redirect/github/testing-library/react-testing-library/issues/1023" data-hovercard-type="pull_request" data-hovercard-url="/testing-library/react-testing-library/pull/1023/hovercard">#1023</a>) (<a href="https://snyk.io/redirect/github/testing-library/react-testing-library/commit/96ed8dafa5d02add2168a3da65d1cc0ffe6d6d1f">96ed8da</a>)</li> </ul> </li> <li> <b>12.1.3</b> - <a href="https://snyk.io/redirect/github/testing-library/react-testing-library/releases/tag/v12.1.3">2022-02-15</a></br><h2><a href="https://snyk.io/redirect/github/testing-library/react-testing-library/compare/v12.1.2...v12.1.3">12.1.3</a> (2022-02-15)</h2> <h3>Bug Fixes</h3> <ul> <li>Add <code>@ types/react-dom</code> as a direct dependency (<a href="https://snyk.io/redirect/github/testing-library/react-testing-library/issues/1001" data-hovercard-type="pull_request" data-hovercard-url="/testing-library/react-testing-library/pull/1001/hovercard">#1001</a>) (<a href="https://snyk.io/redirect/github/testing-library/react-testing-library/commit/149d9a9af3addeb6c49696867b05b87afe0d0b3c">149d9a9</a>)</li> </ul> </li> </ul> from <a href="https://snyk.io/redirect/github/testing-library/react-testing-library/releases">@testing-library/react GitHub release notes</a> </details> </details> <details> <summary><b>Commit messages</b></summary> </br> <details> <summary>Package name: <b>@testing-library/react</b></summary> <ul> <li><a href="https://snyk.io/redirect/github/testing-library/react-testing-library/commit/646129b59659e2f3509a6fff606a9871b2a68a9c">646129b</a> chore: Run release from 12.x branch (#1044)</li> <li><a href="https://snyk.io/redirect/github/testing-library/react-testing-library/commit/9e2b5dbb4632799ae38f1341cb79ef35d1bd6652">9e2b5db</a> fix: Only supports React < 18 (#1041)</li> <li><a href="https://snyk.io/redirect/github/testing-library/react-testing-library/commit/0c4aabe0da1587754229f7614a2ddfdaddd0b1aa">0c4aabe</a> chore: Fix failing codesandbox/ci (#1026)</li> <li><a href="https://snyk.io/redirect/github/testing-library/react-testing-library/commit/96ed8dafa5d02add2168a3da65d1cc0ffe6d6d1f">96ed8da</a> fix: Match runtime type of baseElement in TypeScript types (#1023)</li> </ul> <a href="https://snyk.io/redirect/github/testing-library/react-testing-library/compare/b0f9d9741205c54836bf82b76b86ec001a8c0e1f...646129b59659e2f3509a6fff606a9871b2a68a9c">Compare</a> </details> </details> <hr/> **Note:** *You are seeing this because you or someone else with access to this repository has authorized Snyk to open upgrade PRs.* For more information: <img src="https://api.segment.io/v1/pixel/track?data=eyJ3cml0ZUtleSI6InJyWmxZcEdHY2RyTHZsb0lYd0dUcVg4WkFRTnNCOUEwIiwiYW5vbnltb3VzSWQiOiI2ZDcwZTlkNC05OGFjLTRkNDktYjc0Ny1mY2NlMDI4MTBhMjEiLCJldmVudCI6IlBSIHZpZXdlZCIsInByb3BlcnRpZXMiOnsicHJJZCI6IjZkNzBlOWQ0LTk4YWMtNGQ0OS1iNzQ3LWZjY2UwMjgxMGEyMSJ9fQ==" width="0" height="0"/> 🧐 [View latest project report](https://app.snyk.io/org/sandbox-2ba/project/9043c51f-3f0d-45c6-8455-b658274f2872?utm_source=github&utm_medium=referral&page=upgrade-pr) 🛠 [Adjust upgrade PR settings](https://app.snyk.io/org/sandbox-2ba/project/9043c51f-3f0d-45c6-8455-b658274f2872/settings/integration?utm_source=github&utm_medium=referral&page=upgrade-pr) 🔕 [Ignore this dependency or unsubscribe from future upgrade PRs](https://app.snyk.io/org/sandbox-2ba/project/9043c51f-3f0d-45c6-8455-b658274f2872/settings/integration?pkg=@testing-library/react&utm_source=github&utm_medium=referral&page=upgrade-pr#auto-dep-upgrades) <!--- (snyk:metadata:{"prId":"6d70e9d4-98ac-4d49-b747-fcce02810a21","prPublicId":"6d70e9d4-98ac-4d49-b747-fcce02810a21","dependencies":[{"name":"@testing-library/react","from":"12.1.3","to":"12.1.5"}],"packageManager":"npm","type":"auto","projectUrl":"https://app.snyk.io/org/sandbox-2ba/project/9043c51f-3f0d-45c6-8455-b658274f2872?utm_source=github&utm_medium=referral&page=upgrade-pr","projectPublicId":"9043c51f-3f0d-45c6-8455-b658274f2872","env":"prod","prType":"upgrade","vulns":[],"issuesToFix":[],"upgrade":[],"upgradeInfo":{"versionsDiff":2,"publishedDate":"2022-04-11T20:14:35.067Z"},"templateVariants":[],"hasFixes":false,"isMajorUpgrade":false,"isBreakingChange":false,"priorityScoreList":[]}) ---> --------- Co-authored-by: snyk-bot <snyk-bot@snyk.io>
WIP/Not ready for review
Pull Request Info
Jira
Staged Changes (Requires MongoDB Corp SSO)
Review Guidelines
REVIEWING.md