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

[DOCS] documentation about Subdocuments versus Nested Paths may need revision #13272

Closed
2 tasks done
hasezoey opened this issue Apr 13, 2023 · 3 comments
Closed
2 tasks done
Labels
docs This issue is due to a mistake or omission in the mongoosejs.com documentation

Comments

@hasezoey
Copy link
Collaborator

hasezoey commented Apr 13, 2023

Prerequisites

  • I have written a descriptive issue title
  • I have searched existing issues to ensure the issue has not already been raised

Issue

i have noticed that Subdocuments versus Nested Paths in /docs/subdocs.md the section still mentions that prop: new Schema({ name: String }) and prop: { name: String } a subtly different, even though #7181 has been closed and a51fbcc which should have addressed that to my understanding

(both in master(7.0) and 6.x)

@hasezoey hasezoey added the docs This issue is due to a mistake or omission in the mongoosejs.com documentation label Apr 13, 2023
@vkarpov15 vkarpov15 added this to the 7.0.5 milestone Apr 17, 2023
@vkarpov15
Copy link
Collaborator

I presume this issue is referring to the following text:

In Mongoose, nested paths are subtly different from subdocuments.
For example, below are two schemas: one with `child` as a subdocument,
and one with `child` as a nested path.

Which is correct. #7181 refers to cases where you explicitly specify type: { nestedProp: String }, which is a separate case that had very bad behavior in older versions of Mongoose. There is still a difference between nested paths and subdocuments even in Mongoose 7.

@vkarpov15 vkarpov15 removed this from the 7.0.5 milestone Apr 23, 2023
@hasezoey
Copy link
Collaborator Author

There is still a difference between nested paths and subdocuments even in Mongoose 7.

thanks for clearing that up, i thought in 7.0 both ways would be the same as #7181 would indicate

for reference, what are the differences now (aside form the === undefined mentioned in the docs) and do those difference actually matter? (asking if there is a use-case instead of just creating new schemas all the time like typegoose would currently do)

@vkarpov15
Copy link
Collaborator

Same as listed in those docs: you can set defaults on subdoc paths and subdocs have a deleteOne() method

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs This issue is due to a mistake or omission in the mongoosejs.com documentation
Projects
None yet
Development

No branches or pull requests

2 participants