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-20071) Update TS Limitations #275

Conversation

biniona-mongodb
Copy link
Contributor

@biniona-mongodb biniona-mongodb commented Jan 11, 2022

Pull Request Info

Remove limitation around dot notation. Add warning around recursive types.

Issue JIRA link:

https://jira.mongodb.org/browse/DOCSP-20071
+
https://jira.mongodb.org/browse/DOCSP-20417

Snooty build log:

https://workerpool-boxgs.mongodbstitch.com/pages/job.html?collName=queue&jobId=61f81a59382d7fe4ee46b528

Docs staging link (requires sign-in on MongoDB Corp SSO):

https://docs-mongodbcom-staging.corp.mongodb.com/node/docsworker-xlarge/DOCSP-20071-Support-Dot-Notation-TS/fundamentals/typescript/

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?
  • Does it render on staging correctly?
  • Are all the links working?
  • Are the staging and workerpool job links in the PR description updated?

If your page documents a concept, does it meet the following criteria?

@biniona-mongodb biniona-mongodb marked this pull request as ready for review January 11, 2022 18:50
@biniona-mongodb biniona-mongodb changed the title (DOCSP-20071) Remove TS Limitation (DOCSP-20071) Update TS Limitations Jan 11, 2022
Copy link
Contributor

@ccho-mongodb ccho-mongodb left a comment

Choose a reason for hiding this comment

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

A few minor issues, would like to take another look after changes!

source/fundamentals/typescript.txt Outdated Show resolved Hide resolved
source/fundamentals/typescript.txt Outdated Show resolved Hide resolved
source/fundamentals/typescript.txt Outdated Show resolved Hide resolved
source/fundamentals/typescript.txt Outdated Show resolved Hide resolved
source/fundamentals/typescript.txt Outdated Show resolved Hide resolved
source/fundamentals/typescript.txt Outdated Show resolved Hide resolved
snooty.toml Outdated Show resolved Hide resolved
Copy link
Contributor

@ccho-mongodb ccho-mongodb left a comment

Choose a reason for hiding this comment

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

Some issues I commented on might not be directly related to this PR, so feel free to create JIRA tickets if they are not trivial.

Responding to comments here since I'm unable to add to the outdated threads at the moment:

Re: #275 (comment)

I do not believe the style guide takes a stance on how tabs should be used.

I provided an explanation as to why it doesn't make sense. There isn't guidance on everything you shouldn't do in the style guide, and sometimes there are exceptions to items listed in the style guide. If you disagree with my reasoning, we can discuss as a team. I can ticket the work to update the style guide (or you can) -- let me know what you prefer to do here.

Re: #275 (comment)

I'm not sure a real world example will provide much value for these readers, as they likely are able to relate recursive data structures to real world examples independently.

I'm not sure it's a common use case and would be helpful to demonstrate what this is. Otherwise, I would link to an example.

source/fundamentals/typescript.txt Outdated Show resolved Hide resolved
source/fundamentals/typescript.txt Outdated Show resolved Hide resolved
source/fundamentals/typescript.txt Outdated Show resolved Hide resolved
source/fundamentals/typescript.txt Outdated Show resolved Hide resolved
source/fundamentals/typescript.txt Outdated Show resolved Hide resolved
source/fundamentals/typescript.txt Outdated Show resolved Hide resolved
source/fundamentals/typescript.txt Outdated Show resolved Hide resolved
source/fundamentals/typescript.txt Show resolved Hide resolved
source/includes/limitations/4.3.rst Outdated Show resolved Hide resolved
source/includes/limitations/4.3.rst Outdated Show resolved Hide resolved
Comment on lines 180 to 181
A mutually recursive type exists when two types define themselves relative
to each other. You can update the
Copy link
Contributor

@ccho-mongodb ccho-mongodb Jan 21, 2022

Choose a reason for hiding this comment

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

Just for clarification, I used "property type", which seems consistent with TypeScript nomenclature according to their documentation. An example of a property type of a Type in your MutuallyRecursivePet interface is "string" for (name) or "number" (for age). Let me know if my terminology is incorrect and what the appropriate term is if so.

"Type" is unfortunately and maybe unavoidably ambiguous in the sentence, so I omitted it explicitly in my suggestion.

Copy link
Contributor

@ccho-mongodb ccho-mongodb left a comment

Choose a reason for hiding this comment

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

Looks pretty good. As there's a a fair amount of new/revised content, there are some new minor issues to address.
I'm leaving an approval, but If there's new content to review or discussions required, please reach out.

source/includes/limitations/4.3.rst Outdated Show resolved Hide resolved
source/includes/limitations/4.3.rst Outdated Show resolved Hide resolved
source/includes/limitations/4.3.rst Show resolved Hide resolved
source/includes/limitations/4.3.rst Outdated Show resolved Hide resolved
source/includes/limitations/4.3.rst Outdated Show resolved Hide resolved
Copy link
Contributor

@dariakp dariakp left a comment

Choose a reason for hiding this comment

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

Just have one note here, I am not sure if we need to do anything differently for this PR or wait to merge it. I also have a question regarding where the examples of how to use dot notation correctly are, since the page only seems to talk about limitations for recursive types, but no examples of non-recursive dot notation use. Is there a follow up ticket to add that example?

collection.find({ someRandomKey: "Accepts any type!" });
const database = client.db("<your database>");
const collection = db.collection<User>("<your collection>");
collection.find({ age: "Accepts any type!" });
Copy link
Contributor

Choose a reason for hiding this comment

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

Just a note that this will probably need to change soon to something like { $unknownOperator: "Accepts any type!" } because we actually have a user submitted fix to make sure that we validate unknown keys that aren't $-prefixed but allow all $-prefixed keys for forward compatibility with new server operators. Right now the corresponding note is correct, but once we release a fix, it will need to be updated.

(see mongodb/node-mongodb-native#3115)

Copy link
Contributor Author

@biniona-mongodb biniona-mongodb Jan 28, 2022

Choose a reason for hiding this comment

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

Hi Daria! There is a ticket to add the "query nested fields without dot notation" example back to a different section of the documentation (DevED-DBX agreed that TS page seemed only tangentially related to dot notation and was not the correct place for this content).

The page that should explain to readers how to use Dot Notation is the Update Arrays in a Document Page (linking to Java), however it seems like the corresponding Node page does not explicitly discuss dot notation. I've created a ticket to add this content .

As this PR has already been through a few internal reviews and has grown to be fairly large, I think it is best to close out this pull request and handle the upcoming changes as part of a new task (any substantial additions will require an additional copy review which will take a decent amount of time as the diff for this PR has become pretty big).

Sorry for the long response! Let me know if I have failed to address any of your concerns.

Copy link
Contributor

Choose a reason for hiding this comment

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

I'm fine with doing the $-prefix updates later, but I really feel like the current page could benefit from a working example of dot notation type hinting use (i.e., show how having the wrong type in a non-recursive collection definition raises a typescript error)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good point, I agree an example of working dot notation type checking would benefit readers. I've added a "dot notation" subsection to the Features section Let me know if this addresses your concerns!

@biniona-mongodb biniona-mongodb requested review from dariakp and removed request for dariakp January 31, 2022 17:25
Copy link
Contributor

@dariakp dariakp left a comment

Choose a reason for hiding this comment

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

Just a small nit here, otherwise looks good, thank you! Though I'd like @baileympearson or @nbbeeken to take a look just to make sure we haven't missed anything, since new docs are pretty extensive.

source/fundamentals/typescript.txt Outdated Show resolved Hide resolved
Copy link
Collaborator

@nbbeeken nbbeeken left a comment

Choose a reason for hiding this comment

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

LGTM, good example of dot notation's type safety, I appreciate us sticking with the Pet theme 😁

Copy link
Contributor

@dariakp dariakp left a comment

Choose a reason for hiding this comment

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

LGTM - thanks for implementing all the feedback! Please wait for @nbbeeken to take a second look before merging

@biniona-mongodb biniona-mongodb merged commit 054f1ba into mongodb:master Jan 31, 2022
@biniona-mongodb biniona-mongodb deleted the DOCSP-20071-Support-Dot-Notation-TS branch January 31, 2022 20:32
@biniona-mongodb biniona-mongodb mentioned this pull request Feb 18, 2022
8 tasks
ccho-mongodb pushed a commit that referenced this pull request Sep 23, 2022
ccho-mongodb pushed a commit to ccho-mongodb/docs-node that referenced this pull request Sep 23, 2022
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