How to use the Dataloader correctly w/ Mongoose? #221
Unanswered
mareksuscak
asked this question in
Q&A
Replies: 1 comment 15 replies
-
I do not know much about the Mongoose one, but willing to take a look, could you share your code? |
Beta Was this translation helpful? Give feedback.
15 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi there. I saw the official examples and the documentation but I still do not fully understand how to leverage the built-in dataloader to address a N+1 query issue when using the Mongoose adapter. We keep seeing N+1 queries even when pulling 1st-level connections. We did not provide
batchScheduleFn
and I'm not sure when exactly it's necessary. Looking at some other examples of using the dataloader, it's rarely mentioned. I am expecting to see 2 Mongoose queries - one to retrieve the list of objects and another one to retrieve another list of objects for relationships - is this even how it's expected it to work? In reality what I see is one query to pull a list of objects and another query for each object and connection that's being accessed which seems unnecessary.Beta Was this translation helpful? Give feedback.
All reactions