Home > other >  How to bypass $facet memory 100MB memory limit on each of its pipeline in MongoDB V4.4?
How to bypass $facet memory 100MB memory limit on each of its pipeline in MongoDB V4.4?

Time:12-22

I was working with MongoDB 3.4 and recently upgraded it to 4.4 on Beta environment. I have a query using facet which is giving 100MB size limit exceeded issue.I saw Jira link explaining this issue here: https://jira.mongodb.org/browse/SERVER-40317

The query is dynamically made based on user input so its hard to make changes on query directly I am thinking of it as last resort.

I am looking for anyway to bypass this limit. AllowDiskUsage also doesn't work as stated in above link.

CodePudding user response:

This can help:

  db.adminCommand({setParameter: 1, internalQueryFacetMaxOutputDocSizeBytes: 335544320})

With the above command affected RAM limit changed from default 100MB to 320 MB

to see if the change is in place:

 use admin
 db.runCommand( { getParameter : 1, “internalQueryFacetMaxOutputDocSizeBytes” : 1 } )

This change is temporary , to make it permanent you will need to add to the mongodb.conf file to take effect on startup:

 setParameter:
     internalQueryFacetMaxOutputDocSizeBytes: 335544320

CodePudding user response:

you have to use mongoose utils allowdiskusage like this:

return OrderEntity
        .aggregate(compendiumAggregation(query))
        .allowDiskUse(true)
        .then(success(res))
        .catch(next);
  • Related