Skip to content

How many separate queries when using populate() #12589

Answered by vkarpov15
vresetnikov asked this question in Q&A
Discussion options

You must be logged in to vote

1 per populated field by default. Unless you use cursors or perDocumentLimit. So, for example, await User.find().populate('friends').populate('blogPosts'), that executes 3 queries: 1 for users, 1 for friends, 1 for blog posts.

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by vresetnikov
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants