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-15613): Node.js collections type #1044

Prev Previous commit
Next Next commit
Update source/sdk/node/data-types/collections.txt
Mohammad Hunan Chughtai authored May 7, 2021
commit b1f88fe2e6b5284dee9f7ba0307775c947c85d02
2 changes: 1 addition & 1 deletion source/sdk/node/data-types/collections.txt
Original file line number Diff line number Diff line change
@@ -76,7 +76,7 @@ are usually **live**:
- Live lists always reflect the current state of the relationship on the {+realm+} instance.

A collection is **not** live when:
Copy link
Collaborator

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.

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 see that now, fixed 👍

- 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 which 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.
- 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.
Copy link
Collaborator

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 and for...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?

Copy link
Contributor Author

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