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

replace var with const #9394

Merged
merged 2 commits into from Sep 10, 2020
Merged

replace var with const #9394

merged 2 commits into from Sep 10, 2020

Conversation

ghost
Copy link

@ghost ghost commented Sep 6, 2020

Thanks for submitting a pull request! Please provide enough information so that others can review your pull request. The two fields below are mandatory.

If you're making a change to documentation, do not modify a .html file directly. Instead find the corresponding .pug file or test case in the test/docs directory.

Summary

Examples

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
Copy link
Collaborator

@vkarpov15 vkarpov15 left a comment

Choose a reason for hiding this comment

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

Looks great, other than the arrow function changes, which have numerous issues. Can you please undo those?

docs/guide.pug Outdated
animalSchema.methods.findSimilarTypes = function(cb) {
return mongoose.model('Animal').find({ type: this.type }, cb);
};
animalSchema.methods.findSimilarTypes = cb => (
Copy link
Collaborator

Choose a reason for hiding this comment

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

This change doesn't work because the method uses this, which arrow functions mess up.

docs/guide.pug Outdated
animalSchema.statics.findByName = function(name) {
return this.find({ name: new RegExp(name, 'i') });
};
animalSchema.statics.findByName = name => (
Copy link
Collaborator

Choose a reason for hiding this comment

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

This change doesn't work because the static function uses this, which arrow functions mess up.

docs/guide.pug Outdated
animalSchema.static('findByBreed', function(breed) {
return this.find({ breed });
});
animalSchema.static('findByBreed', breed => this.find({ breed }) )
Copy link
Collaborator

Choose a reason for hiding this comment

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

This change doesn't work because the static function uses this, which arrow functions mess up.

docs/guide.pug Outdated
@@ -325,7 +323,7 @@ block content
define a `fullName` property that won't get persisted to MongoDB.

```javascript
personSchema.virtual('fullName').get(function () {
personSchema.virtual('fullName').get(() => {
Copy link
Collaborator

Choose a reason for hiding this comment

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

This change doesn't work because the virtual getter uses this, which arrow functions mess up.

@ghost
Copy link
Author

ghost commented Sep 8, 2020

Oh! Sorry. That's a major issue. Will remove those. Thanks

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
@vkarpov15 vkarpov15 added this to the 5.10.5 milestone Sep 10, 2020
@vkarpov15 vkarpov15 added the docs This issue is due to a mistake or omission in the mongoosejs.com documentation label Sep 10, 2020
@vkarpov15 vkarpov15 merged commit 1ac769b into Automattic:master Sep 10, 2020
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

Successfully merging this pull request may close these issues.

None yet

1 participant