Is there any way to increase $function's --max-old-space-size?

Hello, I am developing simple Node.js API using MongoDB.

I am using $text search and $function operators on my aggregation pipeline (I know it’s a sin but please help me). When I query using general keywords like “A B C D E” and get thousands of big documents, MongoDB returns MongoServerError on $function’s operator.

{“errMessage” : “PlanExecutor error during aggregation :: caused by :: Out of memory”,“errName”:“JSInterpreterFailure”,“errCode”:139}

My question is, is there any way to increase $function’s max old space size just like on Node.js? Thank you

Welcome to the MongoDB Community @Yukha_Dharmeswara !

There are currently no tuneable settings for adjusting memory limits for the $function operator stage, so you would have to limit your input documents or processing within this stage.

If you are able to share more details, perhaps someone will have a suggestion on how to improve the outcome:

  • your aggregation pipeline
  • version of MongoDB server
  • sample documents
  • expected output


1 Like

Thank you for your advice!

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.