Friday 9 June 2017

How to reduce mongoose query for connectionFromPromisedArray in Relay?

Let's say we have mongoose model of droids and we need to resolve a collection in queryType with method like below:

resolve: (source, args) => connectionFromPromisedArray(Droid.find(), args),

As far as I understand we will fetch more data than we need from MongoDB.

I've tried to write a function that will handle fetching exactly what I need, but then I lose my pageInfo, because Relay assume that my data haven't pages.

So far I've found some libs with one function but every time it bloats app.

Also it would be great to use cursors with mongoose.



via Vadim Shvetsov

No comments:

Post a Comment