GraphQLGuide / apollo-datasource-mongodb

Apollo data source for MongoDB
MIT License
285 stars 64 forks source link

Actually use mongoose model to resolve queries #28

Closed NeoTheThird closed 4 years ago

NeoTheThird commented 4 years ago

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 commented 4 years ago

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 commented 4 years ago

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

NeoTheThird commented 4 years ago

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.

lorensr commented 4 years ago

Thanks a lot, I combined them. Published in 0.2.7