Skip to content

Actually use mongoose model to resolve queries #28

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

Closed

Conversation

NeoTheThird
Copy link
Contributor

This is a part of #27. Thoughts appreciated. To fully close that issue, i propose allowing the setting default fields to populate in the constructor. I'd be happy to take a swing at that as well, if there's interest.

@NeoTheThird
Copy link
Contributor Author

Actually, i'm now thinking it might be best to recommend mongoose-autopopulate for that. This way no further code is needed in this lib and we could consider #27 closed with this. I'd be happy to write a note for the readme.

@lorensr
Copy link
Member

lorensr commented Jun 29, 2020

Thanks Neo! Do you have a take on the implementation in #30? And sounds good re: Readme note, thank you ☺️

@NeoTheThird
Copy link
Contributor Author

I wasn't aware of exec, added it to my PR as well and added that readme note. I think it's a little more elegant to pass in the model directly rather than checking isModel again like #30 does, but i guess that comes down to personal preference. Go with whatever PR you like :) the external api would remain untouched anyways, so it should be up to you, the maintainer, not us, the users of the lib.

@@ -144,8 +146,8 @@ class Users extends MongoDataSource {

updateUserName(userId, newName) {
this.deleteFromCacheById(userId)
return this.collection.updateOne({
_id: userId
Copy link
Contributor Author

Choose a reason for hiding this comment

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

only saw this after my commit, i got my editor set up to remove trailing spaces automagically. unrelated ofc, but i guess they technically have no business being there ;)

@lorensr
Copy link
Member

lorensr commented Jul 15, 2020

Thanks a lot, I combined them. Published in 0.2.7

@lorensr lorensr closed this Jul 15, 2020
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.

2 participants