Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Running into 16MB BSON limit with Mongoose Populate #5890

Open
mayeaux opened this issue Dec 11, 2017 · 2 comments
Open

Running into 16MB BSON limit with Mongoose Populate #5890

mayeaux opened this issue Dec 11, 2017 · 2 comments

Comments

@mayeaux
Copy link

mayeaux commented Dec 11, 2017

I am doing a really large Mongoose call with nested population, and then doing some processing on the data.

However, because of the nested populate call I am hitting the 16MB limit for a BSON document in Mongoose.

What's a solid way around this?

let allDocuments = await exampleModel.find({
    condition: true
  }).populate({path: 'tvShows', populate: {path: 'views'}});

enter image description here

Maybe I can break into into multiple calls? But I'm not sure a logical way to do that. Thanks.

@vkarpov15
Copy link
Collaborator

Populate currently doesn't have support for this. We will fix this bug but will take some time. In the meantime I recommend looping over allDocuments.tvShows and executing a separate query for each ones views

@vkarpov15 vkarpov15 added this to the 4.14 milestone Dec 17, 2017
@mhombach
Copy link

mhombach commented Dec 4, 2018

Bump: What's the plan with this? @vkarpov15 would really appreciate if this would be somehow fixed (or is it already fixed? Didn't run into that problem yet) :)
To all others, who are running into that problem, you can just query without populating and then call populate() on the subdocuments during runtime, so they get "loaded" with sepreate calls after the parent-document is loaded.

@Uzlopak Uzlopak closed this as completed May 2, 2022
@vkarpov15 vkarpov15 reopened this May 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants