GraphQLGuide / apollo-datasource-mongodb

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

Supporting mongoose #5

Closed emilmork closed 5 years ago

emilmork commented 5 years ago

Have you an suggestion for how mongoose could be supported ?

I have tested with mongoose and it seams that the only issue is the .toArray() notation in cache.js. Mongoose is not using the native driver directly and the query result is not a cursor, like in mongodb native client.

I can make a PR with a suggestion but whanted to hear your thoughts first.

ecerroni commented 5 years ago

Have you an suggestion for how mongoose could be supported ?

I have tested with mongoose and it seams that the only issue is the .toArray() notation in cache.js. Mongoose is not using the native driver directly and the query result is not a cursor, like in mongodb native client.

I can make a PR with a suggestion but wanted to hear your thoughts first.

I made a fork of this awesome package to extend the code and support both mongodb driver and mongoose: https://github.com/ecerroni/apollo-datasource-mongodb

However, keep in mind that the API of my fork is not exactly the same as this one anymore and has started to diverge.

emilmork commented 5 years ago

@ecerroni Yes, i actually saw your repo one minute after I posted this question. I will look into it :)

lorensr commented 5 years ago

No suggestion, happy to look at a PR ☺️

emilmork commented 5 years ago

I have created a PR with the same approach as in @ecerroni`s repo.

emilmork commented 5 years ago

@lorensr Do you publish the update to npm as well ? :)

lorensr commented 5 years ago

Published along with an API update: https://github.com/GraphQLGuide/apollo-datasource-mongodb/releases/tag/0.2.0