Open gamebak opened 3 years ago
@gamebak In the end Dataloader only makes a single request with all the ids passed
It doesn't, I've tested this, unless I'm missing something.
It's certainly the intent of the DataLoader function to use $in
:
If it's not working, would be happy to look at a PR that fixes it.
Speed up proposal for method
findManyByIds
.https://github.com/GraphQLGuide/apollo-datasource-mongodb/blob/08e1c076739867a9e73a707adc66767a7e8525d7/src/cache.js#L173
As-Is right now, it's opening a lot of
findOneById
with a promise.all, but it's really inefficient once you have over 100 keys and it's slowing the UI.While I don't exactly know how to implement this in the library exactly, the solution will look similar to this at the mongo level:
This will result in a single call to the server-side, speeding up for bigger queries.