Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

413
Vistas
MongoError: document constructed by $facet is 104860008 bytes, which exceeds the limit of 104857600 bytes

I am getting memory size limit error while running multiple sub-pipelines in $facet. Can someone help me on this issue. Scenario: I have a crown job which runs once a day. I want to execute multiple pipelines using $facet against a collection with millions of documents whenever job is triggered.

[ 
     {
          $facet: {
                  query1: [pipeline_1],
                  query2: [pipeline_2],
                  query3: [pipeline_3]
                  ...
                  query_n: [pipeline_n]
          },
     },
     {
        $merge:{ into: some_collection}
     }
]

I tried db.collection.aggregate([], {allowDiskUse: true});, But still getting same error. What can be the work around on this. Please help.

over 4 years ago · Santiago Trujillo
1 Respuestas
Responde la pregunta

0

In most cases using allowDiskUse should eliminate this error this is why i'm suspecting you're using the wrong syntax for it. Depending on your Mongo version there are some hard limitations on certain operators like $graphLookup, these operators will always have a memory error regardless of the allowDiskUse flag usage.

Assuming you don't use any of these operators allowDiskUse will work, here is a syntax example for the nodejs driver:

db.collection.aggregate([], {allowDiskUse: true});

If you are $graphLookup or one of the other limited operators then there's not much you can do. I would start by splitting these $facet stages into separate pipelines. If the problem still persists you'll need to either optimize the aggregation or find a different approach.

over 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda